Split worksheets into pages
There might be the case when you do not want to render the whole Spreadsheet on a single page and limit the number of rows that would be rendered on each output page. In this situation, the GroupDocs.Viewer for Java allows you to specify the number of rows in an Spreadsheet to be rendered on each page.
The following steps are required for partial rendering of large Excel sheets.
- Instantiate the HtmlViewOptions, JpgViewOptions, PngViewOptions or PdfViewOptions object
- Instantiate SpreadsheetOptions object by calling forSplitSheetIntoPages(…) method and specifying desired
countRowsPerPage
parameter. - Call view(…) method.
Viewer viewer = new Viewer("sample.xlsx");
HtmlViewOptions viewOptions = HtmlViewOptions.forEmbeddedResources();
viewOptions.setSpreadsheetOptions(SpreadsheetOptions.forSplitSheetIntoPages(45));
viewer.view(viewOptions);
viewer.close();
More resources
GitHub Examples
You may easily run the code above and see the feature in action in our GitHub examples:
- GroupDocs.Viewer for Java examples, plugins, and showcase
- Document Viewer for .NET App WebForms UI Modern Example
- Document Viewer for Java App Dropwizard UI Modern Example
- Document Viewer for Java Spring UI Example
- GroupDocs.Viewer for .NET samples, plugins and showcase
- Document Viewer for .NET MVC UI Example
Free Online App
Along with full-featured Java library we provide simple but powerful free Apps. You are welcome to view Word, PDF, Excel, PowerPoint documents with free to use online GroupDocs Viewer App.