We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to Convert first two sheets of excel to PDF and ignore others


I have excel file which has multiple worksheets in it. I am trying to convert excel to PDF.
But my requirement is to convert only first two worksheets of excel file to PDF and ignore other sheets.
Could you please help me to understand how can we achieve this?
Thanks in advance…

Please set PdfSaveOptions.SheetSet property as the following codes:

Workbook workbook = new Workbook(dir + "test.xlsx");
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.setSheetSet(new SheetSet(new int[] { 0, 1 }));
workbook.save(dir + "dest.pdf", pdfSaveOptions);