GroupDocs.Viewer for .NET 23.10 Release Notes

Full list of changes in this release

KeyCategorySummary
VIEWERNET‑4289FeatureRendering Excel spreadsheets by page break and print area
VIEWERNET‑4360FeatureSkip loading of external resources referenced by documents
VIEWERNET‑4491FixObject reference not set to an instance of an object exception when calling GetViewInfo and GetFileInfo methods
VIEWERNET‑4492FixOutdated information in distribution packages
VIEWERNET‑4484FixViewer Horizontal Scrolling Not Working on Excel

Major features

This release includes the following features:

The rendering of the Excel spreadsheets using page break and print area

Now, you can split the printable area into multiple pages, similar to Excel’s printing function. This feature lets you separate pages based on included page breaks in the printable area. To do this, call the SpreadsheetOptions.ForRenderingPrintAreaAndPageBreaks method. For details, see the Split a worksheet into pages page.

//render spreadsheet into PDF
using (var viewer = new Viewer("products.xlsx"))
{
  var viewOptions = new PdfViewOptions("output.pdf");
  viewOptions.SpreadsheetOptions = SpreadsheetOptions.ForRenderingPrintAreaAndPageBreaks();
  viewer.View(viewOptions);
}

//render spreadsheet into HTML
using (var viewer = new Viewer("products.xlsx"))
{
   HtmlViewOptions viewOptions = HtmlViewOptions.ForEmbeddedResources("page_{0}.html");
   viewOptions.SpreadsheetOptions = SpreadsheetOptions.ForRenderingPrintAreaAndPageBreaks();
   viewer.View(viewOptions);
}

Skip loading of external resources referenced by documents

We introduced the SkipExternalResources and WhitelistedResources properties of the LoadOptions class. These options enable you to skip downloading all external resources or create an allowlist to download resources with specific URLs. For details, see the Loading of external resources containing by a document page.

Skip loading all external resources

LoadOptions loadOptions = new LoadOptions();
loadOptions.SkipExternalResources = true; // Skip loading of external resources
using (Viewer viewer = new Viewer("business-flyer.docx", loadOptions))
{
    HtmlViewOptions viewOptions = 
        HtmlViewOptions.ForEmbeddedResources();

    viewer.View(viewOptions);
}

Skip loading external resources, except those with the “avatars.githubusercontent.com” segment in the URL

LoadOptions loadOptions = new LoadOptions();
loadOptions.SkipExternalResources = true; // Skip loading of external resources
loadOptions.WhitelistedResources.Add("avatars.githubusercontent.com"); //Enable loading of external resources that has 'avatars.githubusercontent.com' fragment in resource URL. 
using (Viewer viewer = new Viewer("business-flyer.docx", loadOptions))
{
    HtmlViewOptions viewOptions = 
        HtmlViewOptions.ForEmbeddedResources();

    viewer.View(viewOptions);
}