com.groupdocs.watermark.options

Interfaces

Classes

com.groupdocs.watermark.options

Class SpreadsheetBackgroundWatermarkOptions



  • public final class SpreadsheetBackgroundWatermarkOptions
    extends SpreadsheetWatermarkOptions
    Represents options when adding the watermark as a background to a Spreadsheet worksheet.

    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();
     
    • Method Detail

      • getWorksheetIndex

        public final int getWorksheetIndex()
        Get the index of worksheet to add the watermark to.

        -1 means every worksheet.

        Returns:
        The index of worksheet to add the watermark to.
      • setWorksheetIndex

        public final void setWorksheetIndex(int value)
        Sets the index of worksheet to add the watermark to.

        -1 means every worksheet.

        Parameters:
        value - The index of worksheet to add the watermark to.
      • getBackgroundWidth

        public final int getBackgroundWidth()
        Get the desired width of the background image in pixels.
        Returns:
        The desired width of the background image in pixels.
      • setBackgroundWidth

        public final void setBackgroundWidth(int value)
        Sets the desired width of the background image in pixels.
        Parameters:
        value - The desired width of the background image in pixels.
      • getBackgroundHeight

        public final int getBackgroundHeight()
        Gets or sets the desired height of the background image in pixels.
        Returns:
        The desired height of the background image in pixels.
      • setBackgroundHeight

        public final void setBackgroundHeight(int value)
        Gets or sets the desired height of the background image in pixels.
        Parameters:
        value - The desired height of the background image in pixels.