This technical tip shows how to convert an Excel XLS file to PDF even if it contains any images or charts within it. You will be using Aspose.Cells and Aspose.Pdf libraries for XLS2PDF conversion. Please also make sure to save your Aspose.Pdf XML file on disk, not in a stream because Aspose.Pdf XML file is being used as a medium to preserve those image files.

[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]

' 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")

More about Aspose.Cells

- Homepage of Aspose.Cells:
- Read more technical tips by Aspose.Cells.

More about Aspose.Pdf

- Homepage of Aspose.Pdf.
- Read more technical tips by Aspose.Pdf.

Contact Information
Suite 119, 272 Victoria Avenue
Chatswood, NSW, 2067
Australia
Aspose - The .NET and Java component publisher
sales@aspose.com
Phone: 888.277.6734
Fax: 866.810.94651