Pages

Sunday, May 10, 2009

Convert an Excel XLS file to PDF

There are many times when developer needs to convert their files into the another format like excel, pdf, xml, word, etc. The following tip would let you find out that how to convert an excel file into the pdf format. See the below code:

C#

// Saving an XLS file in Aspose.Pdf xml format
Workbook wb = new Workbook();
wb.Open("C:\\book1.xls);
wb.Save("C:\\xls2pdf.xml", FileFormatType.AsposePdf);

// Converting XLS file to PDF through Aspose.Pdf using Aspose.Pdf xml file as a medium
Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
pdf.BindXML("c:\\xls2pdf.xml", null);
pdf.Save("C:\\xls2pdf.pdf");

VB.NET

' Saving an XLS file in Aspose.Pdf xml format
Dim wb as Workbook = new Workbook()
wb.Open("C:\book1.xls)
wb.Save("C:\xls2pdf.xml", FileFormatType.AsposePdf)

' Converting XLS file to PDF through Aspose.Pdf using Aspose.Pdf xml file as a medium
Dim pdf as Aspose.Pdf.Pdf = new Aspose.Pdf.Pdf()
pdf.BindXML("c:\\xls2pdf.xml", null)
pdf.Save("C:\xls2pdf.pdf")

No comments:

Post a Comment