com.groupdocs.viewer.converter.options

Class CellsOptions



  • public class CellsOptions
    extends Object

    The Spreadsheet documents rendering options.

    • Field Detail

      • COUNT_ROWS_PER_PAGE_DEFAULT

        public static final int COUNT_ROWS_PER_PAGE_DEFAULT
        See Also:
        Constant Field Values
      • ONE_PAGE_PER_SHEET_DEFAULT

        public static final boolean ONE_PAGE_PER_SHEET_DEFAULT
        See Also:
        Constant Field Values
      • RENDER_PRINT_AREA_ONLY_DEFAULT

        public static final boolean RENDER_PRINT_AREA_ONLY_DEFAULT
        See Also:
        Constant Field Values
      • SHOW_GRID_LINES_DEFAULT

        public static final boolean SHOW_GRID_LINES_DEFAULT
        See Also:
        Constant Field Values
      • TEXT_OVERFLOW_MODE_DEFAULT

        public static final int TEXT_OVERFLOW_MODE_DEFAULT
        See Also:
        Constant Field Values
    • Constructor Detail

      • CellsOptions

        public CellsOptions()

        Initializes a new instance of the CellsOptions class.

    • Method Detail

      • setCountRowsPerPage

        public void setCountRowsPerPage(int value)

        The number of rows rendered into one page when one page per sheet rendering mode is not enabled. Default value is 50.

        Example:
        The following example demonstrates how to set rendering of 100 rows into each page.

         ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler();
         ImageOptions options = new ImageOptions();
         options.getCellsOptions().setOnePagePerSheet(false);
         options.getCellsOptions().setCountRowsPerPage(100);
        
         String guid = "document.xlsx";
         List<PageHtml> pages = htmlHandler.getPages(guid, options);
         

        Parameters:
        value - The number of rows rendered into one page.
      • setEncoding

        public void setEncoding(Charset value)

        The text (*.csv) document encoding.

        Example:
        The following example demonstrates how to set Encoding for rendering csv documents.

         ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler();
         HtmlOptions options = new HtmlOptions();
         options.getCellsOptions().setEncoding(Charset.forName("utf-8"));
        
         String guid = "encoded.csv";
         List<PageHtml> pages = htmlHandler.getPages(guid, options);
         

        Parameters:
        value - The text document encoding.
      • setIgnoreEmptyColumns

        public final void setIgnoreEmptyColumns(boolean value)

        Indicates whether empty columns should be ignored. The default value is false.

        Example:
        The following example demonstrates how to ignore empty columns when rendering Spreadsheet document.

         ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler();
         HtmlOptions options = new HtmlOptions();
         options.getCellsOptions().setIgnoreEmptyColumns(true);
        
         String guid = "document.xlsx";
         List<PageHtml> pages = htmlHandler.getPages(guid, options);
         

        Parameters:
        value - Whether empty columns should be ignored.
      • setIgnoreEmptyRows

        public void setIgnoreEmptyRows(boolean value)

        Indicates whether empty columns should be ignored.

        Example:
        The following example demonstrates how to ignore empty columns when rendering Spreadsheet document.

         ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler();
         HtmlOptions options = new HtmlOptions();
         options.getCellsOptions().setIgnoreEmptyColumns(true);
        
         String guid = "document.xlsx";
         List<PageHtml> pages = htmlHandler.getPages(guid, options);
         

        Parameters:
        value - Whether empty columns should be ignored.
      • setInternalHyperlinkPrefix

        public void setInternalHyperlinkPrefix(String value)

        Prefix for hyperlink that references worksheet inside the same document.

        Note:
        Excel workbook may contain hyperlink to specific location in the same workbook. Internal hyperlink prefix is useful for applications where workbook sheets are rendered separately one by one. In this case internal hyperlink may contain some REST API method address with referenced sheet name. Value may contain page number placeholder which will be substituted with referenced sheet number.

        Example:
        The following example demonstrates how to set prefix for internal hyperlinks.

         ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler();
         HtmlOptions options = new HtmlOptions();
         options.getCellsOptions().setInternalHyperlinkPrefix("http://contoso.com/api/getPage?number={page-number}");
        
         String guid = "document.xlsx";
         List<PageHtml> pages = htmlHandler.getPages(guid, options);
         

        Parameters:
        value - Prefix for hyperlink that references worksheet inside the same document.
      • setOnePagePerSheet

        public void setOnePagePerSheet(boolean value)

        Specifies worksheet rendering mode.

        Note:
        When one page per sheet rendering is enabled, all worksheet content is rendered into a single page. Otherwise worksheet content is divided into pages, where each page includes count of rows defined in count rows per page option.

        Example:
        The following example demonstrates how to enable one page per sheet rendering mode.

         ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler();
         HtmlOptions options = new HtmlOptions();
         options.getCellsOptions().setOnePagePerSheet(true);
        
         String guid = "document.xlsx";
         List<PageHtml> pages = htmlHandler.getPages(guid, options);
         

        Parameters:
        value - Worksheet rendering mode.
      • setRenderPrintAreaOnly

        public void setRenderPrintAreaOnly(boolean value)

        Enables rendering of the specific section(s) on a worksheet(s) which is defined as print area.

        Example:
        The following example demonstrates how to render print area.

         ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler();
         HtmlOptions options = new HtmlOptions();
         options.getCellsOptions().setRenderPrintAreaOnly(true);
        
         String guid = "document.xlsx";
         List<PageHtml> pages = htmlHandler.getPages(guid, options);
         

        Parameters:
        value - Enables rendering of the specific section(s) on a worksheet(s) which is defined as print area.
      • setShowGridLines

        public void setShowGridLines(boolean value)

        Indicates whether to show grid lines in converted document. The default value is false.

        Example:
        The following example demonstrates how to set ShowGridLines property.

         ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler();
         HtmlOptions options = new HtmlOptions();
         options.getCellsOptions().setShowGridLines(true);
        
         string guid = "document.xlsx";
         List<PageHtml> pages = htmlHandler.getPages(guid, options);
         

        Parameters:
        value - Indicates whether to show grid lines in converted document.
      • setShowHiddenColumns

        public void setShowHiddenColumns(boolean value)

        Enables rendering hidden columns.

        Example:
        The following example demonstrates how to render hidden columns.

         ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler();
         HtmlOptions options = new HtmlOptions();
         options.getCellsOptions().setShowHiddenColumns(true);
        
         String guid = "document.xlsx";
         List<PageHtml> pages = htmlHandler.getPages(guid, options);
         

        Parameters:
        value - Enables rendering hidden columns.
      • setShowHiddenRows

        public void setShowHiddenRows(boolean value)

        Enables rendering hidden rows.

        Example:
        The following example demonstrates how to render hidden rows.

         ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler();
         HtmlOptions options = new HtmlOptions();
         options.getCellsOptions().setShowHiddenRows(true);
        
         String guid = "document.xlsx";
         List<PageHtml> pages = htmlHandler.getPages(guid, options);
         

        Parameters:
        value - Enables rendering hidden rows.
      • setTextOverflowMode

        public void setTextOverflowMode(int value)

        Text overflow mode applied when the text is too big to fit into the cell. Default value is TextOverflowMode.OverlayIfNextIsEmpty.

        Note:
        Text overflow mode is only applicable for rendering into HTML.

        Example:
        The following example demonstrates how to set TextOverflowMode property.

         ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler();
         HtmlOptions options = new HtmlOptions();
         options.getCellsOptions().setTextOverflowMode(TextOverflowMode.Overlay);
        
         String guid = "longtext.xlsx";
         List<PageHtml> pages = htmlHandler.getPages(guid, options);
         

        Parameters:
        value - Text overflow mode applied when the text is too big to fit into the cell. Possible options are in TextOverflowMode.