Excel Spreadsheets - Manually Enforced Page Breaks


#1

I have a long, single-worksheet Excel file. I have manually enforced page breaks every 75 rows. In the Document Viewer, the file displays as a single, huge page. Same if I render as HTML for printing.

Is there a way to have the page breaks recognized, as if the file contained multiple worksheets?

Thank you.


#2

@penguintrax,

Thanks for contacting support.

Yes, GroupDocs.Viewer allows breaking up the large Excel worksheets into multiple pages. Furthermore, you can also specify the number of rows you want to display on each page. The following code samples show how to achieve it.

  • C# (supported by GroupDocs.Viewer for .NET 17.1.0 and greater)
ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(); 
ImageOptions options = new ImageOptions();
// Set Html options for multiple pages per sheet.
options.CellsOptions.OnePagePerSheet = false;
// Set count rows to render on each page. Default value is 50. 
options.CellsOptions.CountRowsPerPage = 75; 
string guid = "document.xlsx"; 
// Get pages.
List<PageHtml> pages = htmlHandler.GetPages(guid, options);
  • Java (supported by GroupDocs.Viewer for Java 3.7.0 and greater)
ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(); 
// Set Html options for multiple pages per sheet. 
HtmlOptions htmlOptions = new HtmlOptions();
htmlOptions.getCellsOptions().setOnePagePerSheet(false);
// Set count rows to render on each page Default value is 50.
htmlOptions.getCellsOptions().setCountRowsPerPage(75);
string guid = "document.xlsx"; 
// Get Pages.
List<PageHtml> pages = htmlHandler.getPages(guid, htmlOptions); 

This feature is supported in both, HTML-based rendering and image-based rendering. Hope it helps.


#3

Thank you Usman!


#4

@penguintrax,

You are welcome.