Finding out how many pages will be exported
If you need to calculate the number of pages a report will take without actually exporting it or printing it, you can use the code below.
public int NumberOfPagesToExport(ExcelFile xls)
{
using (FlexCelImgExport img = new FlexCelImgExport(xls))
{
var ExportInfo = img.GetFirstPageExportInfo();
return ExportInfo.TotalPages;
}
}
You can use the FlexCelImgExport.GetFirstPageExportInfo method to find out a lot of information about how the pages will be exported. For example, you might have set a "Print to fit" in one page wide, and wonder which zoom FlexCel will use to fit the page. If the zoom is too small, you might want to change it to fit in two pages wide. To get the zoom used in the page, you can use:
public double FinalZoom(ExcelFile xls, int sheet)
{
using (FlexCelImgExport img = new FlexCelImgExport(xls))
{
var ExportInfo = img.GetFirstPageExportInfo();
return ExportInfo.Sheet(sheet).ZoomUsed;
}
}