@D04486411
Unfortunately, we do not have GetViewInfo
method that can be used when exporting to PDF. But you can still use PngViewInfoOptions
to retrieve the list of pages that are going to be rendered. The following code is rather a workaround that is based on the fact that a worksheet name should be unique.
using(Viewer viewer = new Viewer("spreadsheet.xlsx"))
{
ViewInfoOptions viewInfoOptions = ViewInfoOptions.ForPngView();
viewInfoOptions.SpreadsheetOptions = SpreadsheetOptions.ForSplitSheetIntoPages(50);
ViewInfo viewInfo = viewer.GetViewInfo(viewInfoOptions);
viewInfo.Pages
.GroupBy(p => p.Name)
.Select(g => new { Worksheet = g.Key, CountPages = g.Count() })
.ToList()
.ForEach(r => Console.WriteLine($"{r.Worksheet} : {r.CountPages}"));
}
Sample console output:
Sheet1 : 3
Sheet2 : 5