Render print areas

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.Viewerprovides 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.

using (Viewer viewer = new Viewer("sample.xlsx"))
{
    HtmlViewOptions viewOptions = HtmlViewOptions.ForEmbeddedResources();
    viewOptions.SpreadsheetOptions = SpreadsheetOptions.ForRenderingPrintArea();
    viewer.View(viewOptions);
}

More resources

View Excel Files Online

Along with full-featured .NET library we provide simple but powerful free online Apps. View Excel XLS, XLSX, and XLSB files online with GroupDocs Viewer App.

GitHub Examples

You may easily run the code above and see the feature in action in our GitHub examples: