This technical tip shows how an Excel XLS document can be converted to PDF file. Aspose.Cells compon

This tip submitted by sherazam on 2013-09-18 00:05:36. It has been viewed 6242 times.
Rating of 6.9 with 30 votes

This technical tip shows how an Excel XLS document can be converted to PDF file. Aspose.Cells component is designed to provide a fast and convenient way to convert any type of Excel spreadsheet into PDF format. The purpose of this article is to demonstrate step by step process to do the conversion into PDF format. Since we all know the great essence of Excel files remains in: the cells are organized in rows and columns into different worksheets, and contain all types of data or formulas with relative or absolute references to other cells. The Intuitive interface related formatting and capable calculation and graphing ability which have made it the dominant spreadsheet in the market today. It not only has editing options, but also possesses the versatility of spreadsheet management. This makes it easier to perform statistical analyses and manipulations on any type of data of any volume. Similarly, PDF (Portable Document Format) has its own advantages. The file format represents documents in a manner that is independent of the original application software, hardware, and operating system used to create those documents. Aspose.Cells is an Excel� spreadsheet reporting component that enables you to read and write Excel� spreadsheets without utilizing Microsoft Excel� installed either on the client or server side. Aspose.Cells is a feature rich component that offers much more than just basic exporting of data. With Aspose.Cells , developers can export data, format spreadsheets in every detail and at every level, import images, import charts, create charts, manipulate charts, stream Excel� data, save in various formats including XLS, CSV, PDF, SpreadsheetML, TabDelimited, TXT, XML ( Aspose.Pdf integrated) and many more. Aspose.Cells has a huge list of features. Please take a look over the following code snippet for this approach.

Converting the XLS file to PDF Format


using System;
using System.IO;
using System.Windows.Forms;
using Aspose.Cells;

namespace AsposeExcel2PdfConverter
/// AsposeExcel2PdfConverter
/// Use Aspose.Cells to perform the task

class Class1
/// The main entry point for the application.

static void Main(string[] args)
// Uncomment the code below when you have purchased
// license for Aspose.Cells. You need to
// deploy the license in the same folder as your
// executable, alternatively you can add the license
// file as an embedded resource to your project.
// // Set license for Aspose.Cells
// Aspose.Cells.License cellsLicense = new
// Aspose.Cells.License();
// cellsLicense.SetLicense("Aspose.Cells.lic");

//Get the path of the Application folder.
string path = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Application.ExecutablePath), "..\\..");
//Get the template excel file path.
string designerFile = path + @"\Files\PurchasingReport.xls";
//Specify the pdf file path.
string pdfFile = path + @"\Files\PurchasingReport.pdf";
//Create a new Workbook.
//Open the template excel file which you have to
Aspose.Cells.Workbook wb = new Aspose.Cells.Workbook(designerFile);
//Save the pdf file.
wb.Save(pdfFile, SaveFormat.Pdf);

catch (Exception e)


More tips

Help your fellow programmers! Add a tip!