public final class SpreadsheetBackgroundWatermarkOptions extends SpreadsheetWatermarkOptions
Learn more:
The following example demonstrates how to add a text watermark to an Excel document worksheet as background.
SpreadsheetLoadOptions loadOptions = new SpreadsheetLoadOptions(); Watermarker watermarker = new Watermarker("C:\\Documents\\test.xlsx", loadOptions); TextWatermark watermark = new TextWatermark("Test watermark", new Font("Arial", 36)); SpreadsheetBackgroundWatermarkOptions options = new SpreadsheetBackgroundWatermarkOptions(); options.setWorksheetIndex(-1); // default options.setBackgroundWidth(800); options.setBackgroundHeight(600); watermarker.save("C:\\Documents\\watermarked_test.xlsx"); watermarker.close();
Constructor and Description |
---|
SpreadsheetBackgroundWatermarkOptions()
Initializes a new instance of the
class. |
Modifier and Type | Method and Description |
---|---|
int |
getBackgroundHeight()
Gets or sets the desired height of the background image in pixels.
|
int |
getBackgroundWidth()
Get the desired width of the background image in pixels.
|
int |
getWorksheetIndex()
Get the index of worksheet to add the watermark to.
|
void |
setBackgroundHeight(int value)
Gets or sets the desired height of the background image in pixels.
|
void |
setBackgroundWidth(int value)
Sets the desired width of the background image in pixels.
|
void |
setWorksheetIndex(int value)
Sets the index of worksheet to add the watermark to.
|
public SpreadsheetBackgroundWatermarkOptions()
SpreadsheetBackgroundWatermarkOptions
class.public final int getWorksheetIndex()
-1 means every worksheet.
public final void setWorksheetIndex(int value)
-1 means every worksheet.
value
- The index of worksheet to add the watermark to.public final int getBackgroundWidth()
public final void setBackgroundWidth(int value)
value
- The desired width of the background image in pixels.public final int getBackgroundHeight()
public final void setBackgroundHeight(int value)
value
- The desired height of the background image in pixels.