Is there any way to convert the active sheet to a PDF file?
Thanks,
Adam
Hi Adam,
Yes, you may try to hide your unwanted worksheets for your requirements, e.g.., Consult the following line of code.
workbook.Worksheets[sheetIndex].IsVisible = false;
Thank you.
Hi,
Thank you for considering Aspose.
Aspose.Cells only exports the visible worksheets in a workbook, so you can hide the un-wanted
worksheets in your workbook before saving it as PDF. Please see the sample code for your
convenience.
Sample Code:
//Create a Workbook.
Workbook excelWorkbook0 = new Workbook();
//Open a file into the workbook.
excelWorkbook0.Open(@"C:\styles_test1.xls");
//Hide the first two worksheets , so that the remaining sheets can be exported to PDF.
for (int i = 0; i < 2; i++)
{
excelWorkbook0.Worksheets[i].IsVisible = false;
}
//Save the file.
excelWorkbook0.Save(@"C:\FinalBook.pdf", FileFormatType.Pdf);
Thank You & Best Regards,