[]
Gets the total number of pages associated with the current page printing event.
This value represents the total page count for the print operation that raised the current PagePrintingEventArgs or PagePrintedEventArgs instance.
public int PageCount { get; }
Public ReadOnly Property PageCount As Integer
worksheet.Range["A1:A96"].Value = 1;
int pageCount = 0;
PdfSaveOptions options = new PdfSaveOptions();
options.PagePrinting += (sender, e) =>
{
pageCount = e.PageCount;
};
using MemoryStream stream = new MemoryStream();
workbook.Save(stream, options);