Render print areas

This article explains how to view Spreadsheet print areas with GroupDocs.Viewer within your Java applications.

Introduction

Spreadsheet document allows to set a print area if you want to print a specific section on a worksheet. There can be the case when you want to render only the print area of the worksheet using GroupDocs.Viewer. 

The Solution

GroupDocs.Viewer provides an option to render sections of the worksheet(s) defined as the “print area”. It renders each print area in a worksheet as a separate page. The following code samples show how to render only the print areas from worksheets.

    Viewer viewer = new Viewer("sample.xlsx");
    HtmlViewOptions viewOptions = HtmlViewOptions.forEmbeddedResources();
    viewOptions.setSpreadsheetOptions(SpreadsheetOptions.forRenderingPrintArea());
    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:

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.