com.groupdocs.watermark

Interfaces

Classes

Exceptions

com.groupdocs.watermark

Class CellsDocument

  • All Implemented Interfaces:
    com.aspose.ms.System.IDisposable, Closeable, AutoCloseable


    public class CellsDocument
    extends Document

    Represents an Excel document where a watermark can be placed.

    This example demonstrates how to load and save Excel document of any supported type.

    CellsDocument document = Document.load(CellsDocument.class, "D:\\input.xls");
      
      // Use addWatermark method to add watermark to all worksheets.
      
      // Use the collection of frames to add watermark to a particular worksheet.
      
      // Save changes.
      document.save("D:\\output.xls");
      document.close();
      
    • Method Detail

      • getWorksheets

        public final CellsWorksheetCollection getWorksheets()

        Gets the collection of all worksheets of this CellsDocument.

        Returns:
        The collection of all worksheets of this CellsDocument.

        This example demonstrates how to add watermark to a particular worksheet.

        CellsDocument document = Document.load(CellsDocument.class, "D:\\input.xls");
         // Initialize text or image watermark.
         TextWatermark watermark = new TextWatermark("DRAFT", new Font("Arial", 19));
         // Add watermark to a particular worksheet.
         document.getWorksheets().get_Item(0).addWatermark(watermark);
         // Save changes.
         document.save("D:\\output.xls");
         document.close();
         
      • addWatermark

        public final void addWatermark(Watermark watermark,
                        CellsShapeSettings shapeSettings)

        Adds a watermark to all worksheets of this CellsDocument. This method assumes that watermark offset and size are measured in points (if they are assigned).

        Parameters:
        watermark - The watermark to add to the document.
        shapeSettings - Settings that should be applied to the watermark.
      • addImageWatermark

        public final void addImageWatermark(ImageWatermark watermark,
                             CellsImageEffects effects,
                             CellsShapeSettings shapeSettings)

        Adds an image watermark to all worksheets of this CellsDocument. This method assumes that watermark offset and size are measured in points (if they are assigned).

        Parameters:
        watermark - The image watermark to add to the document.
        effects - Image effects that should be applied to the watermark.
        shapeSettings - Shape settings that should be applied to the watermark.
      • addImageWatermark

        public final void addImageWatermark(ImageWatermark watermark,
                             CellsImageEffects effects)

        Adds an image watermark to all worksheets of this CellsDocument. This method assumes that watermark offset and size are measured in points (if they are assigned).

        Parameters:
        watermark - The image watermark to add to the document.
        effects - Image effects that should be applied to the watermark.
      • addTextWatermark

        public final void addTextWatermark(TextWatermark watermark,
                            CellsTextEffects effects,
                            CellsShapeSettings shapeSettings)

        Adds a text watermark to all worksheets of this CellsDocument. This method assumes that watermark offset and size are measured in points (if they are assigned).

        Parameters:
        watermark - The text watermark to add to the document.
        effects - Text effects that should be applied to the watermark.
        shapeSettings - Shape settings that should be applied to the watermark.
      • addTextWatermark

        public final void addTextWatermark(TextWatermark watermark,
                            CellsTextEffects effects)

        Adds a text watermark to all worksheets of this CellsDocument. This method assumes that watermark offset and size are measured in points (if they are assigned).

        Parameters:
        watermark - The text watermark to add to the document.
        effects - Text effects that should be applied to the watermark.
      • addWatermarkAsBackground

        public final void addWatermarkAsBackground(Watermark watermark,
                                    int backgroundWidth,
                                    int backgroundHeight)

        Adds a watermark to all worksheets of this CellsDocument as backgrounds. This method assumes that watermark offset and size are measured in pixels (if they are assigned). Backgrounds are viewable in Normal View in worksheet, and are invisible in Page Layout mode. The image is automatically tiled on the background of the worksheet.

        Parameters:
        watermark - The watermark to add to the document.
        backgroundWidth - Desired width of the background image in pixels.
        backgroundHeight - Desired height of the background image in pixels.


        Image watermarks: Excel formats don't support background image customization. So it will be applied to an image itself. Using properties of image watermark (size, rotation etc) or backgroundHeight and backgroundWidth parameters will cause image redrawing. This may lead to decrease of performance. Text watermarks: text background is not supported. So text watermark will be rasterized.

      • addWatermarkAsBackground

        public final void addWatermarkAsBackground(Watermark watermark)

        Adds a watermark to all worksheets of this CellsDocument as backgrounds. This method assumes that watermark offset and size are measured in pixels (if they are assigned). Backgrounds are viewable in Normal View in worksheet, and are invisible in Page Layout mode. The image is automatically tiled on the background of the worksheet.

        Parameters:
        watermark - The watermark to add to the document.


        Image watermarks: Excel formats don't support background image customization. So it will be applied to an image itself. Using properties of image watermark (size, rotation etc) or backgroundHeight and backgroundWidth parameters will cause image redrawing. This may lead to decrease of performance. Text watermarks: text background is not supported. So text watermark will be rasterized.

      • addModernWordArtWatermark

        public final void addModernWordArtWatermark(TextWatermark watermark,
                                     CellsShapeSettings shapeSettings)

        Adds a rectangular shape with text inside to all worksheets of this CellsDocument. This method assumes that watermark offset and size are measured in points (if they are assigned).

        Parameters:
        watermark - The text watermark to add to the document.
        shapeSettings - Settings that should be applied to a shape watermark.
      • addModernWordArtWatermark

        public final void addModernWordArtWatermark(TextWatermark watermark)

        Adds a rectangular shape with text inside to all worksheets of this CellsDocument. This method assumes that watermark offset and size are measured in points (if they are assigned).

        Parameters:
        watermark - The text watermark to add to the document.
      • addWatermarkIntoHeaderFooter

        public final void addWatermarkIntoHeaderFooter(Watermark watermark)

        Adds a watermark into the header or footer of all worksheets contained in this CellsDocument. This method assumes that watermark offset and size are measured in points (if they are assigned). You’ll see the watermark in Excel only when you’re in Page Layout view or Print Preview.

        Parameters:
        watermark - The watermark to add to the document.
      • encrypt

        public final void encrypt(String password)

        Encrypts the document.

        Parameters:
        password - The password that will be required to open the document.
      • decrypt

        public final void decrypt()

        Decrypts the document.

      • dispose

        protected void dispose(boolean disposing)

        Releases all resources used by the CellsDocument

        Overrides:
        dispose in class Document
        Parameters:
        disposing - True to release both managed and unmanaged resources; false to release only unmanaged resources.