Free Support Forum - aspose.com

Convert Excel with multiple worksheets

When converting an excel file that has multiple worksheets to PDF can I capture each worksheet as a separate PDF page?

Thanks

Hi,

Yes, you may do it. You can set some PageSetup options before saving the file to PDF format for your requirement. e.g

(Note: You may change my code accordingly for your need too.)

Workbook workbook = new Workbook();
workbook.Open(“f:\test\MyFile.xls”);

foreach (Worksheet ws in workbook.Worksheets)
{
ws.PageSetup.Orientation = PageOrientationType.Landscape;
ws.PageSetup.FitToPagesTall = 1;
ws.PageSetup.FitToPagesWide = 0;

}

workbook.Save(“f:\test\outputFile.pdf”, FileFormatType.Pdf);



Thank you.