com.groupdocs.watermark

Interfaces

Classes

Exceptions

com.groupdocs.watermark

Class CellsWorksheet



  • public class CellsWorksheet
    extends DocumentPart

    Represents an Excel document worksheet.

    • Method Detail

      • getPageSetup

        public final CellsPageSetup getPageSetup()

        Gets the printing page setup for this CellsWorksheet.

        Returns:
        Page setup for the worksheet.
      • getContentAreaWidth

        public final double getContentAreaWidth()

        Gets the width of the content area in points.

        Returns:
        The width of the content area in points.
      • getContentAreaWidthPx

        public final int getContentAreaWidthPx()

        Gets the width of the content area in pixels.

        Returns:
        The width of the content area in pixels.
      • getContentAreaHeight

        public final double getContentAreaHeight()

        Gets the height of the content area in points.

        Returns:
        The height of the content area in points.
      • getContentAreaHeightPx

        public final int getContentAreaHeightPx()

        Gets the height of the content area in pixels.

        Returns:
        The height of the content area in pixels.
      • getShapes

        public final CellsShapeCollection getShapes()

        Gets the collection of all shapes of this CellsWorksheet.

        Returns:
        The collection of all shapes of this CellsWorksheet.
      • getAttachments

        public final CellsAttachmentCollection getAttachments()

        Gets the collection of all attachments of this CellsWorksheet.

        Returns:
        The collection of all attachments of this CellsWorksheet.
      • getCharts

        public final CellsChartCollection getCharts()

        Gets the collection of all charts of this CellsWorksheet.

        Returns:
        The collection of all charts of this CellsWorksheet.
      • getBackgroundImage

        public final CellsWatermarkableImage getBackgroundImage()

        Gets the background image of this CellsWorksheet.

        Returns:
        The background image of this CellsWorksheet. Returns null if the worksheet has no background image.

        This example demonstrates how to set the background image for a worksheet.

        CellsDocument document = Document.load(CellsDocument.class, "D:\\input.xls");
         File file = new File("D:\\background.jpg");
         byte[] imageBytes = new byte[(int)file.length()];
         InputStream inputStream = new FileInputStream(file);
         inputStream.read(imageBytes);
         inputStream.close();
         // Set the background image.
         document.getWorksheets().get_Item(0).setBackgroundImage(new CellsWatermarkableImage(imageBytes));
         // Save changes.
         document.save("D:\\output.xls");
         document.close();
         
      • setBackgroundImage

        public final void setBackgroundImage(CellsWatermarkableImage value)

        Sets the background image of this CellsWorksheet.

        Parameters:
        value - The background image of this CellsWorksheet. Returns null if the worksheet has no background image.

        This example demonstrates how to set the background image for a worksheet.

        CellsDocument document = Document.load(CellsDocument.class, "D:\\input.xls");
         File file = new File("D:\\background.jpg");
         byte[] imageBytes = new byte[(int)file.length()];
         InputStream inputStream = new FileInputStream(file);
         inputStream.read(imageBytes);
         inputStream.close();
         // Set the background image.
         document.getWorksheets().get_Item(0).setBackgroundImage(new CellsWatermarkableImage(imageBytes));
         // Save changes.
         document.save("D:\\output.xls");
         document.close();
         
      • getHeadersFooters

        public final CellsHeaderFooterCollection getHeadersFooters()

        Gets the collection of worksheet headers and footers.

        Returns:
        The collection of headers and footers.

        This example demonstrates how to insert image in a particular header/footer.

      • getColumnWidth

        public final double getColumnWidth(int column)

        Gets the width of the specified column in points.

        Parameters:
        column - The column index.
        Returns:
        The width of the column in points.
      • getColumnWidthPx

        public final int getColumnWidthPx(int column)

        Gets the width of the specified column in pixels.

        Parameters:
        column - The column index.
        Returns:
        The width of the column in pixels.
      • getRowHeight

        public final double getRowHeight(int row)

        Gets the height of the specified row in points.

        Parameters:
        row - The row index.
        Returns:
        The height of the row in points.
      • getRowHeightPx

        public final int getRowHeightPx(int row)

        Gets the height of the specified row in pixels.

        Parameters:
        row - The row index.
        Returns:
        The height of the row in pixels.
      • addWatermark

        public final void addWatermark(Watermark watermark,
                        CellsShapeSettings shapeSettings)

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

        Parameters:
        watermark - The watermark to add to the worksheet.
        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 this CellsWorksheet. 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 worksheet.
        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 this CellsWorksheet. 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 worksheet.
        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 this CellsWorksheet. 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 worksheet.
        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 this CellsWorksheet. 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 worksheet.
        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 the worksheet as background. 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 worksheet.
        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 the worksheet as background. 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 worksheet.


        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.

      • addWatermarkIntoHeaderFooter

        public final void addWatermarkIntoHeaderFooter(Watermark watermark)

        Adds a watermark into the header or footer of this CellsWorksheet. 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 worksheet.
      • addModernWordArtWatermark

        public final void addModernWordArtWatermark(TextWatermark watermark,
                                     CellsShapeSettings shapeSettings)

        Adds a rectangular shape with text inside to this CellsWorksheet. 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 worksheet.
        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 this CellsWorksheet. 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 worksheet.