public class SpreadsheetOptions extends Object
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
}
Viewer,
PngViewOptions| Modifier and Type | Method and Description |
|---|---|
static SpreadsheetOptions |
forOnePagePerSheet()
Creates a new instance of
SpreadsheetOptions class for rendering one sheet into one page. |
static SpreadsheetOptions |
forRenderingByPageBreaks()
Initializes a new instance of the
SpreadsheetOptions class for rendering print areas only. |
static SpreadsheetOptions |
forRenderingPrintArea()
Initializes a new instance of the
SpreadsheetOptions class for rendering print areas only. |
static SpreadsheetOptions |
forRenderingPrintAreaAndPageBreaks()
Initializes a new instance of
SpreadsheetOptions for rendering print areas and page breaks. |
static SpreadsheetOptions |
forSplitSheetIntoPages(int countRowsPerPage)
Creates a new instance of
SpreadsheetOptions class for rendering a sheet into multiple pages. |
static SpreadsheetOptions |
forSplitSheetIntoPages(int countRowsPerPage,
int countColumnsPerPage)
Initializes a new instance of the
SpreadsheetOptions class for rendering a sheet into pages. |
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.
|
int |
getCountColumnsPerPage()
Gets the count of columns to include into each page when splitting the worksheet into pages.
|
int |
getCountRowsPerPage()
Gets the count of rows to include into each page when splitting the worksheet into pages.
|
double |
getLeftMargin()
To set left margin of the worksheet when converting to pdf
if less than 0 then default convert value is used
|
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.
|
TextOverflowMode |
getTextOverflowMode()
Returns the text overflow mode for rendering spreadsheet documents into HTML.
|
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.
|
boolean |
isDetectSeparator()
Detects the separator for CSV/TSV files.
|
boolean |
isOnePagePerSheet()
Indicates whether one sheet is rendered into one page.
|
boolean |
isRenderByPageBreaks()
Determines whether the worksheet should be rendered by page breaks.
|
boolean |
isRenderGridLines()
Enables rendering of grid lines.
|
boolean |
isRenderHeadings()
Checks if headings rendering is enabled.
|
boolean |
isRenderHiddenColumns()
Enables hidden columns rendering.
|
boolean |
isRenderHiddenRows()
Determines whether hidden rows should be rendered.
|
boolean |
isRenderingPrintAreaAndPageBreaks()
When this option is enabled, a worksheet will be rendered by page breaks that fall within the print area.
|
boolean |
isRenderPrintAreaOnly()
Indicates whether only the print areas are rendered.
|
boolean |
isSkipEmptyColumns()
Indicates whether empty columns should be skipped during rendering.
|
boolean |
isSkipEmptyRows()
Indicates whether empty rows should be skipped during rendering.
|
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.
|
void |
setCountColumnsPerPage(int countColumnsPerPage)
Sets the count of columns to include into each page when splitting the worksheet into pages.
|
void |
setDetectSeparator(boolean detectSeparator)
Sets whether to detect the separator for CSV/TSV files.
|
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
|
void |
setRenderByPageBreaks(boolean renderByPageBreaks)
Sets whether the worksheet should be rendered by page breaks.
|
void |
setRenderGridLines(boolean value)
Enables or disables the rendering of grid lines.
|
void |
setRenderHeadings(boolean renderHeadings)
Enables headings rendering.
|
void |
setRenderHiddenColumns(boolean value)
Enables hidden columns rendering.
|
void |
setRenderHiddenRows(boolean value)
Sets whether hidden rows should be rendered.
|
void |
setRenderingPrintAreaAndPageBreaks(boolean renderingPrintAreaAndPageBreaks)
Sets whether to render a worksheet by page breaks that fall within the print area.
|
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.
|
void |
setSkipEmptyColumns(boolean value)
Sets whether empty columns should be skipped during rendering.
|
void |
setSkipEmptyRows(boolean value)
Sets whether empty rows should be skipped during rendering.
|
void |
setTextOverflowMode(TextOverflowMode value)
Sets the text overflow mode for rendering spreadsheet documents into HTML.
|
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.
|
public static SpreadsheetOptions forOnePagePerSheet()
Creates a new instance of SpreadsheetOptions class for rendering one sheet into one page.
SpreadsheetOptions class for rendering one sheet into one page.public static SpreadsheetOptions forRenderingByPageBreaks()
SpreadsheetOptions class for rendering print areas only.
For details, see the documentation.SpreadsheetOptions for rendering print areas only. The behavior is similar to printing in Excel, where the worksheet is rendered by page breaks.public static SpreadsheetOptions forRenderingPrintArea()
Initializes a new instance of the SpreadsheetOptions class for rendering print areas only.
SpreadsheetOptions class for rendering print areas only.public static SpreadsheetOptions forRenderingPrintAreaAndPageBreaks()
SpreadsheetOptions for rendering print areas and page breaks.
For details, see the documentation.SpreadsheetOptions for rendering pages based on page breaks that are included into print area. The behavior is similar to printing in Excel.public static SpreadsheetOptions forSplitSheetIntoPages(int countRowsPerPage) throws IllegalArgumentException
Creates a new instance of SpreadsheetOptions class for rendering a sheet into multiple pages.
countRowsPerPage - The number of rows to include in each page.SpreadsheetOptions for rendering a sheet into pages.IllegalArgumentException - Thrown when countRowsPerPage is equal to or less than zero.public static SpreadsheetOptions forSplitSheetIntoPages(int countRowsPerPage, int countColumnsPerPage)
Initializes a new instance of the SpreadsheetOptions class for rendering a sheet into pages.
countRowsPerPage - The number of rows to include on each page.countColumnsPerPage - The number of columns to include on each page.SpreadsheetOptions class for rendering a sheet into pages.public double getBottomMargin()
public int getCountColumnsPerPage()
Gets the count of columns to include into each page when splitting the worksheet into pages.
For details, see the documentation.
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.
public double getLeftMargin()
If the parameter is less than 0, then the default value is used. For details, see the documentation.
public double getRightMargin()
public final TextOverflowMode getTextOverflowMode()
Returns the text overflow mode for rendering spreadsheet documents into HTML.
For details, see the documentation.public double getTopMargin()
public boolean isDetectSeparator()
Detects the separator for CSV/TSV files.
For details, see the documentation.
true if the separator should be automatically detected, false otherwise.public final boolean isOnePagePerSheet()
Indicates whether one sheet is rendered into one page.
true if one sheet is rendered into one page; false otherwise.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.
true if the worksheet should be rendered by page breaks, false otherwise.public final boolean isRenderGridLines()
Enables rendering of grid lines.
For details, see the documentation.
true if grid lines are enabled, false otherwise.public boolean isRenderHeadings()
Checks if headings rendering is enabled.
For details, see the documentation.
true if headings rendering is enabled, false otherwise.public final boolean isRenderHiddenColumns()
Enables hidden columns rendering.
For details, see the documentation.
true if hidden columns rendering is enabled, false otherwise.public final boolean isRenderHiddenRows()
Determines whether hidden rows should be rendered.
For details, see the documentation.
true if hidden rows should be rendered, false otherwise.public boolean isRenderingPrintAreaAndPageBreaks()
public final boolean isRenderPrintAreaOnly()
Indicates whether only the print areas are rendered.
true if only the print areas are rendered, false otherwise.public final boolean isSkipEmptyColumns()
Indicates whether empty columns should be skipped during rendering.
For details, see the documentation.
true if empty columns are skipped, false otherwise.public final boolean isSkipEmptyRows()
Indicates whether empty rows should be skipped during rendering.
For details, see the documentation.
true if empty rows should be skipped, false otherwise.public void setBottomMargin(double bottomMargin)
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.
countColumnsPerPage - The count of columns to include into each page.public void setDetectSeparator(boolean detectSeparator)
Sets whether to detect the separator for CSV/TSV files.
For details, see the documentation.
detectSeparator - true to automatically detect the separator, false otherwise.public void setLeftMargin(double leftMargin)
If the parameter is less than 0, then the default value is used. For details, see the documentation.
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.
renderByPageBreaks - true if the worksheet should be rendered by page breaks, false otherwise.public final void setRenderGridLines(boolean value)
Enables or disables the rendering of grid lines.
For details, see the documentation.
value - true to enable grid lines rendering, false to disable it.public void setRenderHeadings(boolean renderHeadings)
Enables headings rendering.
For details, see the documentation.
renderHeadings - true to enable headings rendering, false to disable.public final void setRenderHiddenColumns(boolean value)
Enables hidden columns rendering.
For details, see the documentation.
value - true to enable hidden columns rendering, false to disable.public final void setRenderHiddenRows(boolean value)
Sets whether hidden rows should be rendered.
For details, see the documentation.
value - true to enable rendering of hidden rows, false to disable it.public void setRenderingPrintAreaAndPageBreaks(boolean renderingPrintAreaAndPageBreaks)
renderingPrintAreaAndPageBreaks - Set to true to enable, false to disable.public void setRightMargin(double rightMargin)
public final void setSkipEmptyColumns(boolean value)
Sets whether empty columns should be skipped during rendering.
For details, see the documentation.
value - true to skip empty columns, false otherwise.public final void setSkipEmptyRows(boolean value)
Sets whether empty rows should be skipped during rendering.
For details, see the documentation.
value - true to skip empty rows, false otherwise.public final void setTextOverflowMode(TextOverflowMode value)
value - The text overflow mode to be set.public void setTopMargin(double topMargin)
Copyright © 2025. All rights reserved.