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. For details, see children of the Render spreadsheet files topic.
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. |
isRenderingPrintAreaAndPageBreaks() | When this option is enabled, a worksheet will be rendered by page breaks that fall within the print area. |
setRenderingPrintAreaAndPageBreaks(boolean renderingPrintAreaAndPageBreaks) | Sets whether to render a worksheet by page breaks that fall within the print area. |
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 If the parameter is less than 0, then the default 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 If the parameter is less than 0, then the default 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 If the parameter is less than 0, then the default 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 If the parameter is less than 0, then the default 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 If the parameter is less than 0, then the default 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 If the parameter is less than 0, then the default value is used. |
forRenderingPrintAreaAndPageBreaks() | Initializes a new instance of SpreadsheetOptions for rendering print areas and page breaks. |
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.
For details, see the documentation.
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.
For details, see the documentation.
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.
For details, see the documentation.
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.
For details, see the documentation.
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.
For details, see the documentation.
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.
For details, see the documentation.
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.
For details, see the documentation.
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.
For details, see the documentation.
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.
For details, see the documentation.
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.
isRenderingPrintAreaAndPageBreaks()
public boolean isRenderingPrintAreaAndPageBreaks()
When this option is enabled, a worksheet will be rendered by page breaks that fall within the print area.
Returns: boolean
setRenderingPrintAreaAndPageBreaks(boolean renderingPrintAreaAndPageBreaks)
public void setRenderingPrintAreaAndPageBreaks(boolean renderingPrintAreaAndPageBreaks)
Sets whether to render a worksheet by page breaks that fall within the print area.
Parameters:
Parameter | Type | Description |
---|---|---|
renderingPrintAreaAndPageBreaks | boolean | Set to true to enable, false to disable. |
isRenderGridLines()
public final boolean isRenderGridLines()
Enables rendering of grid lines.
For details, see the documentation.
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.
For details, see the documentation.
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.
For details, see the documentation.
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.
For details, see the documentation.
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.
For details, see the documentation.
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.
For details, see the documentation.
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.
For details, see the documentation.
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.
For details, see the documentation.
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.
For details, see the documentation.
Returns: boolean - true if headings rendering is enabled, false otherwise.
setRenderHeadings(boolean renderHeadings)
public void setRenderHeadings(boolean renderHeadings)
Enables headings rendering.
For details, see the documentation.
Parameters:
Parameter | Type | Description |
---|---|---|
renderHeadings | boolean | true to enable headings rendering, false to disable. |
isRenderHiddenColumns()
public final boolean isRenderHiddenColumns()
Enables hidden columns rendering.
For details, see the documentation.
Returns: boolean - true if hidden columns rendering is enabled, false otherwise.
setRenderHiddenColumns(boolean value)
public final void setRenderHiddenColumns(boolean value)
Enables hidden columns rendering.
For details, see the documentation.
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.
For details, see the documentation.
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. For details, see the documentation.
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
If the parameter is less than 0, then the default value is used. For details, see the documentation.
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
If the parameter is less than 0, then the default value is used. For details, see the documentation.
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 If the parameter is less than 0, then the default value is used. For details, see the documentation.
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 If the parameter is less than 0, then the default value is used. For details, see the documentation.
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 If the parameter is less than 0, then the default value is used. For details, see the documentation.
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 If the parameter is less than 0, then the default value is used. For details, see the documentation.
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 If the parameter is less than 0, then the default value is used. For details, see the documentation.
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 If the parameter is less than 0, then the default value is used. For details, see the documentation.
Parameters:
Parameter | Type | Description |
---|---|---|
bottomMargin | double |
forRenderingPrintAreaAndPageBreaks()
public static SpreadsheetOptions forRenderingPrintAreaAndPageBreaks()
Initializes a new instance of SpreadsheetOptions for rendering print areas and page breaks. For details, see the documentation.
Returns: SpreadsheetOptions - New instance of SpreadsheetOptions for rendering pages based on page breaks that are included into print area. The behavior is similar to printing in Excel.
forRenderingByPageBreaks()
public static SpreadsheetOptions forRenderingByPageBreaks()
Initializes a new instance of the SpreadsheetOptions class for rendering print areas only. For details, see the documentation.
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.