SpreadsheetOptions

Inheritance: java.lang.Object

public class SpreadsheetOptions

Provides options for rendering spreadsheets.

The SpreadsheetOptions class encapsulates various settings and parameters that can be used to control the rendering of spreadsheet files (such as Excel or CSV files) in the GroupDocs.Viewer component.

Example usage:


 PngViewOptions pngViewOptions = new PngViewOptions();
 SpreadsheetOptions spreadsheetOptions = pngViewOptions.getSpreadsheetOptions();
 spreadsheetOptions.setRenderHeadings(true);
 spreadsheetOptions.setCountColumnsPerPage(24);

 try (Viewer viewer = new Viewer("document.docx")) {
     viewer.view(pngViewOptions);
     // Use the viewer object for further operations
 }
 

Methods

Method Description
isRenderByPageBreaks() Determines whether the worksheet should be rendered by page breaks.
setRenderByPageBreaks(boolean renderByPageBreaks) Sets whether the worksheet should be rendered by page breaks.
isDetectSeparator() Detects the separator for CSV/TSV files.
setDetectSeparator(boolean detectSeparator) Sets whether to detect the separator for CSV/TSV files.
forOnePagePerSheet() Creates a new instance of SpreadsheetOptions class for rendering one sheet into one page.
forSplitSheetIntoPages(int countRowsPerPage) Creates a new instance of SpreadsheetOptions class for rendering a sheet into multiple pages.
forSplitSheetIntoPages(int countRowsPerPage, int countColumnsPerPage) Initializes a new instance of the SpreadsheetOptions class for rendering a sheet into pages.
forRenderingPrintArea() Initializes a new instance of the SpreadsheetOptions class for rendering print areas only.
isOnePagePerSheet() Indicates whether one sheet is rendered into one page.
getCountRowsPerPage() Gets the count of rows to include into each page when splitting the worksheet into pages.
getCountColumnsPerPage() Gets the count of columns to include into each page when splitting the worksheet into pages.
setCountColumnsPerPage(int countColumnsPerPage) Sets the count of columns to include into each page when splitting the worksheet into pages.
isRenderPrintAreaOnly() Indicates whether only the print areas are rendered.
isRenderGridLines() Enables rendering of grid lines.
setRenderGridLines(boolean value) Enables or disables the rendering of grid lines.
isSkipEmptyRows() Indicates whether empty rows should be skipped during rendering.
setSkipEmptyRows(boolean value) Sets whether empty rows should be skipped during rendering.
isSkipEmptyColumns() Indicates whether empty columns should be skipped during rendering.
setSkipEmptyColumns(boolean value) Sets whether empty columns should be skipped during rendering.
isRenderHiddenRows() Determines whether hidden rows should be rendered.
setRenderHiddenRows(boolean value) Sets whether hidden rows should be rendered.
isRenderHeadings() Checks if headings rendering is enabled.
setRenderHeadings(boolean renderHeadings) Enables headings rendering.
isRenderHiddenColumns() Enables hidden columns rendering.
setRenderHiddenColumns(boolean value) Enables hidden columns rendering.
getTextOverflowMode() Returns the text overflow mode for rendering spreadsheet documents into HTML.
setTextOverflowMode(TextOverflowMode value) Sets the text overflow mode for rendering spreadsheet documents into HTML.
getLeftMargin() To set left margin of the worksheet when converting to pdf if less than 0 then default convert value is used
setLeftMargin(double leftMargin) To set left margin of the worksheet when converting to pdf if less than 0 then default convert value is used
getRightMargin() To set right margin of the worksheet when converting to pdf if less than 0 then default convert value is used
setRightMargin(double rightMargin) To set right margin of the worksheet when converting to pdf if less than 0 then default convert value is used
getTopMargin() To set top margin of the worksheet when converting to pdf if less than 0 then default convert value is used
setTopMargin(double topMargin) To set top margin of the worksheet when converting to pdf if less than 0 then default convert value is used
getBottomMargin() To set bottom margin of the worksheet when converting to pdf if less than 0 then default convert value is used
setBottomMargin(double bottomMargin) To set bottom margin of the worksheet when converting to pdf if less than 0 then default convert value is used
forRenderingByPageBreaks() Initializes a new instance of the SpreadsheetOptions class for rendering print areas only.

isRenderByPageBreaks()

public boolean isRenderByPageBreaks()

Determines whether the worksheet should be rendered by page breaks.

Note: This option controls the rendering behavior of the worksheet, similar to printing a spreadsheet in Excel.

Returns: boolean - true if the worksheet should be rendered by page breaks, false otherwise.

setRenderByPageBreaks(boolean renderByPageBreaks)

public void setRenderByPageBreaks(boolean renderByPageBreaks)

Sets whether the worksheet should be rendered by page breaks.

Note: This option controls the rendering behavior of the worksheet, similar to printing a spreadsheet in Excel.

Parameters:

Parameter Type Description
renderByPageBreaks boolean true if the worksheet should be rendered by page breaks, false otherwise.

isDetectSeparator()

public boolean isDetectSeparator()

Detects the separator for CSV/TSV files.

Returns: boolean - true if the separator should be automatically detected, false otherwise.

setDetectSeparator(boolean detectSeparator)

public void setDetectSeparator(boolean detectSeparator)

Sets whether to detect the separator for CSV/TSV files.

Parameters:

Parameter Type Description
detectSeparator boolean true to automatically detect the separator, false otherwise.

forOnePagePerSheet()

public static SpreadsheetOptions forOnePagePerSheet()

Creates a new instance of SpreadsheetOptions class for rendering one sheet into one page.

Returns: SpreadsheetOptions - a new instance of SpreadsheetOptions class for rendering one sheet into one page.

forSplitSheetIntoPages(int countRowsPerPage)

public static SpreadsheetOptions forSplitSheetIntoPages(int countRowsPerPage)

Creates a new instance of SpreadsheetOptions class for rendering a sheet into multiple pages.

Parameters:

Parameter Type Description
countRowsPerPage int The number of rows to include in each page.

Returns: SpreadsheetOptions - a new instance of SpreadsheetOptions for rendering a sheet into pages.

forSplitSheetIntoPages(int countRowsPerPage, int countColumnsPerPage)

public static SpreadsheetOptions forSplitSheetIntoPages(int countRowsPerPage, int countColumnsPerPage)

Initializes a new instance of the SpreadsheetOptions class for rendering a sheet into pages.

Parameters:

Parameter Type Description
countRowsPerPage int The number of rows to include on each page.
countColumnsPerPage int The number of columns to include on each page.

Returns: SpreadsheetOptions - a new instance of the SpreadsheetOptions class for rendering a sheet into pages.

forRenderingPrintArea()

public static SpreadsheetOptions forRenderingPrintArea()

Initializes a new instance of the SpreadsheetOptions class for rendering print areas only.

Returns: SpreadsheetOptions - a new instance of the SpreadsheetOptions class for rendering print areas only.

isOnePagePerSheet()

public final boolean isOnePagePerSheet()

Indicates whether one sheet is rendered into one page.

Returns: boolean - true if one sheet is rendered into one page; false otherwise.

getCountRowsPerPage()

public final int getCountRowsPerPage()

Gets the count of rows to include into each page when splitting the worksheet into pages.

Returns: int - the count of rows to include into each page.

getCountColumnsPerPage()

public int getCountColumnsPerPage()

Gets the count of columns to include into each page when splitting the worksheet into pages.

Returns: int - the count of columns to include into each page.

setCountColumnsPerPage(int countColumnsPerPage)

public void setCountColumnsPerPage(int countColumnsPerPage)

Sets the count of columns to include into each page when splitting the worksheet into pages.

Parameters:

Parameter Type Description
countColumnsPerPage int The count of columns to include into each page.

isRenderPrintAreaOnly()

public final boolean isRenderPrintAreaOnly()

Indicates whether only the print areas are rendered.

Returns: boolean - true if only the print areas are rendered, false otherwise.

isRenderGridLines()

public final boolean isRenderGridLines()

Enables rendering of grid lines.

Returns: boolean - true if grid lines are enabled, false otherwise.

setRenderGridLines(boolean value)

public final void setRenderGridLines(boolean value)

Enables or disables the rendering of grid lines.

Parameters:

Parameter Type Description
value boolean true to enable grid lines rendering, false to disable it.

isSkipEmptyRows()

public final boolean isSkipEmptyRows()

Indicates whether empty rows should be skipped during rendering.

Returns: boolean - true if empty rows should be skipped, false otherwise.

setSkipEmptyRows(boolean value)

public final void setSkipEmptyRows(boolean value)

Sets whether empty rows should be skipped during rendering.

Parameters:

Parameter Type Description
value boolean true to skip empty rows, false otherwise.

isSkipEmptyColumns()

public final boolean isSkipEmptyColumns()

Indicates whether empty columns should be skipped during rendering.

Returns: boolean - true if empty columns are skipped, false otherwise.

setSkipEmptyColumns(boolean value)

public final void setSkipEmptyColumns(boolean value)

Sets whether empty columns should be skipped during rendering.

Parameters:

Parameter Type Description
value boolean true to skip empty columns, false otherwise.

isRenderHiddenRows()

public final boolean isRenderHiddenRows()

Determines whether hidden rows should be rendered.

Returns: boolean - true if hidden rows should be rendered, false otherwise.

setRenderHiddenRows(boolean value)

public final void setRenderHiddenRows(boolean value)

Sets whether hidden rows should be rendered.

Parameters:

Parameter Type Description
value boolean true to enable rendering of hidden rows, false to disable it.

isRenderHeadings()

public boolean isRenderHeadings()

Checks if headings rendering is enabled.

Returns: boolean - true if headings rendering is enabled, false otherwise.

setRenderHeadings(boolean renderHeadings)

public void setRenderHeadings(boolean renderHeadings)

Enables headings rendering.

Parameters:

Parameter Type Description
renderHeadings boolean true to enable headings rendering, false to disable.

isRenderHiddenColumns()

public final boolean isRenderHiddenColumns()

Enables hidden columns rendering.

Returns: boolean - true if hidden columns rendering is enabled, false otherwise.

setRenderHiddenColumns(boolean value)

public final void setRenderHiddenColumns(boolean value)

Enables hidden columns rendering.

Parameters:

Parameter Type Description
value boolean true to enable hidden columns rendering, false to disable.

getTextOverflowMode()

public final TextOverflowMode getTextOverflowMode()

Returns the text overflow mode for rendering spreadsheet documents into HTML.

Returns: TextOverflowMode - the text overflow mode.

setTextOverflowMode(TextOverflowMode value)

public final void setTextOverflowMode(TextOverflowMode value)

Sets the text overflow mode for rendering spreadsheet documents into HTML.

Parameters:

Parameter Type Description
value TextOverflowMode The text overflow mode to be set.

getLeftMargin()

public double getLeftMargin()

To set left margin of the worksheet when converting to pdf if less than 0 then default convert value is used

Returns: double

setLeftMargin(double leftMargin)

public void setLeftMargin(double leftMargin)

To set left margin of the worksheet when converting to pdf if less than 0 then default convert value is used

Parameters:

Parameter Type Description
leftMargin double

getRightMargin()

public double getRightMargin()

To set right margin of the worksheet when converting to pdf if less than 0 then default convert value is used

Returns: double

setRightMargin(double rightMargin)

public void setRightMargin(double rightMargin)

To set right margin of the worksheet when converting to pdf if less than 0 then default convert value is used

Parameters:

Parameter Type Description
rightMargin double

getTopMargin()

public double getTopMargin()

To set top margin of the worksheet when converting to pdf if less than 0 then default convert value is used

Returns: double

setTopMargin(double topMargin)

public void setTopMargin(double topMargin)

To set top margin of the worksheet when converting to pdf if less than 0 then default convert value is used

Parameters:

Parameter Type Description
topMargin double

getBottomMargin()

public double getBottomMargin()

To set bottom margin of the worksheet when converting to pdf if less than 0 then default convert value is used

Returns: double

setBottomMargin(double bottomMargin)

public void setBottomMargin(double bottomMargin)

To set bottom margin of the worksheet when converting to pdf if less than 0 then default convert value is used

Parameters:

Parameter Type Description
bottomMargin double

forRenderingByPageBreaks()

public static SpreadsheetOptions forRenderingByPageBreaks()

Initializes a new instance of the SpreadsheetOptions class for rendering print areas only.

Returns: SpreadsheetOptions - a new instance of SpreadsheetOptions for rendering print areas only. The behavior is similar to printing in Excel, where the worksheet is rendered by page breaks.