SpreadsheetContent
Inheritance: java.lang.Object, com.groupdocs.watermark.contents.ContentPart, com.groupdocs.watermark.contents.Content
All Implemented Interfaces: com.groupdocs.watermark.internal.IEncryptable
public class SpreadsheetContent extends Content implements IEncryptable
Represents an Excel document where a watermark can be placed.
Learn more:
- Add watermarks to spreadsheet documents
- Shapes in spreadsheet document
- Working with spreadsheet document attachments
- Working with worksheet backgrounds
- Working with worksheet headers and footers
The following example demonstrates how to load and save Excel content of any supported type.
SpreadsheetLoadOptions loadOptions = new SpreadsheetLoadOptions(); Watermarker watermarker = new Watermarker(“D:\input.xls”, loadOptions);
// Use add method to add watermark to a particular or all worksheets.
// Save changes. watermarker.save(“D:\output.xls”); watermarker.close();
Constructors
Methods
| Method | Description |
|---|---|
| getWorksheets() | Gets the collection of all worksheets of this [SpreadsheetContent](../../com.groupdocs.watermark.contents/spreadsheetcontent). |
| getAsposeCellsWorkbook() | |
| addWatermark(Watermark watermark, SpreadsheetShapeSettings shapeSettings, ISpreadsheetWatermarkEffects effects) | |
| addWatermarkAsBackground(Watermark watermark, int backgroundWidth, int backgroundHeight) | |
| addModernWordArtWatermark(TextWatermark watermark, SpreadsheetShapeSettings shapeSettings) | |
| addWatermarkIntoHeaderFooter(Watermark watermark) | |
| encrypt(String password) | Encrypts the content. |
| decrypt() | Decrypts the document. |
| performSave(String filePath) | |
| performSave(String filePath, SaveOptions saveOptions) | |
| performSave(OutputStream stream) | |
| performSave(OutputStream stream, SaveOptions saveOptions) | |
| getDocumentInfo() | |
| getFileType() | |
| add(Watermark watermark, WatermarkOptions options) | |
| generatePreview(PreviewOptions previewOptions) |
SpreadsheetContent(StreamContainer stream, StrategyManager strategyManager, FileFormatInfo fileFormatInfo, SpreadsheetLoadOptions spreadsheetLoadOptions, WatermarkerSettings watermarkerSettings)
public SpreadsheetContent(StreamContainer stream, StrategyManager<Integer> strategyManager, FileFormatInfo fileFormatInfo, SpreadsheetLoadOptions spreadsheetLoadOptions, WatermarkerSettings watermarkerSettings)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| stream | StreamContainer | |
| strategyManager | com.groupdocs.watermark.internal.StrategyManager<java.lang.Integer> | |
| fileFormatInfo | com.aspose.cells.FileFormatInfo | |
| spreadsheetLoadOptions | SpreadsheetLoadOptions | |
| watermarkerSettings | WatermarkerSettings |
getWorksheets()
public final SpreadsheetWorksheetCollection getWorksheets()
Gets the collection of all worksheets of this [SpreadsheetContent](../../com.groupdocs.watermark.contents/spreadsheetcontent).
Returns:
SpreadsheetWorksheetCollection - The collection of all worksheets of this [SpreadsheetContent](../../com.groupdocs.watermark.contents/spreadsheetcontent).
getAsposeCellsWorkbook()
public final Workbook getAsposeCellsWorkbook()
Returns: com.aspose.cells.Workbook
addWatermark(Watermark watermark, SpreadsheetShapeSettings shapeSettings, ISpreadsheetWatermarkEffects effects)
public final void addWatermark(Watermark watermark, SpreadsheetShapeSettings shapeSettings, ISpreadsheetWatermarkEffects effects)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| watermark | Watermark | |
| shapeSettings | SpreadsheetShapeSettings | |
| effects | ISpreadsheetWatermarkEffects |
addWatermarkAsBackground(Watermark watermark, int backgroundWidth, int backgroundHeight)
public final void addWatermarkAsBackground(Watermark watermark, int backgroundWidth, int backgroundHeight)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| watermark | Watermark | |
| backgroundWidth | int | |
| backgroundHeight | int |
addModernWordArtWatermark(TextWatermark watermark, SpreadsheetShapeSettings shapeSettings)
public final void addModernWordArtWatermark(TextWatermark watermark, SpreadsheetShapeSettings shapeSettings)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| watermark | TextWatermark | |
| shapeSettings | SpreadsheetShapeSettings |
addWatermarkIntoHeaderFooter(Watermark watermark)
public final void addWatermarkIntoHeaderFooter(Watermark watermark)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| watermark | Watermark |
encrypt(String password)
public final void encrypt(String password)
Encrypts the content.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| password | java.lang.String | The password that will be required to open the document. |
decrypt()
public final void decrypt()
Decrypts the document.
performSave(String filePath)
public void performSave(String filePath)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| filePath | java.lang.String |
performSave(String filePath, SaveOptions saveOptions)
public void performSave(String filePath, SaveOptions saveOptions)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| filePath | java.lang.String | |
| saveOptions | SaveOptions |
performSave(OutputStream stream)
public void performSave(OutputStream stream)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| stream | java.io.OutputStream |
performSave(OutputStream stream, SaveOptions saveOptions)
public void performSave(OutputStream stream, SaveOptions saveOptions)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| stream | java.io.OutputStream | |
| saveOptions | SaveOptions |
getDocumentInfo()
public IDocumentInfo getDocumentInfo()
Returns: IDocumentInfo
getFileType()
public FileType getFileType()
Returns: FileType
add(Watermark watermark, WatermarkOptions options)
public void add(Watermark watermark, WatermarkOptions options)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| watermark | Watermark | |
| options | WatermarkOptions |
generatePreview(PreviewOptions previewOptions)
public void generatePreview(PreviewOptions previewOptions)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| previewOptions | PreviewOptions |