Print sheet to pdf

Does Aspose support the printing off a sheet to pdf ? I am looking for a way to create a pdf per sheet in my workbook.


Thanks,


Bart

Hi,

Well, yes, you may do it. You can hide all the sheets and then un-hide each sheet to save a separate pdf file,

See the following sample codes for reference:

Sample code (Aspose.Cells for Java):

Workbook excelWorkbook0 = new Workbook();
excelWorkbook0.open("f:\\test\\testSourceBook.xls");

int totalsheets = excelWorkbook0.getWorksheets().size();

for (int i = 0; i < totalsheets; i++)
{
excelWorkbook0.getWorksheets().getSheet(i).setVisible(false);

}


for (int i = 0; i < totalsheets; i++)
{
excelWorkbook0.getWorksheets().getSheet(i).setVisible(true);
excelWorkbook0.save("f:\\test\\outotest.xml", FileFormatType.ASPOSE_PDF);
Pdf pdf = Pdf.bindXML(new FileInputStream("f:\\test\\outotest.xml"));
pdf.save(new FileOutputStream("f:\\test\\out_MyPdf" + i + ".pdf"));
excelWorkbook0.getWorksheets().getSheet(i).setVisible(false);


}

Sample code (Aspose.Cells for .NET):

Workbook excelWorkbook0 = new Workbook();
excelWorkbook0.Open(@"f:\test\testSourceBook.xls");
int totalsheets = excelWorkbook0.Worksheets.Count;

for (int i = 0; i < totalsheets; i++)
{
excelWorkbook0.Worksheets[i].IsVisible = false;

}


for (int i = 0; i < totalsheets; i++)
{
excelWorkbook0.Worksheets[i].IsVisible = true;
excelWorkbook0.Save(@"f:\test\outfile_Pdf" + i.ToString() + ".pdf", FileFormatType.Pdf);
excelWorkbook0.Worksheets[i].IsVisible = false;
}

Thank you.