Free Support Forum -

ASP.NET code to generate pdf file by calling an Excel file


This is ajay asthana.I am working in e-enable technologies. I have problem to generate pdf file from excel file at run time.

First i generate Excel file then convert it to pdf file. I need solution to directly generate pdf file at run time.

Please sent a code in to generate pdf file at run time.


Thanks & regards


Ajay Asthana

To convert an Excel file to pdf file in an app, please try this piece of sample code:

Excel excel = new Excel();

// or you can call following piece of code to open an Excel file in memory

//excel.Open(excelStream, FileFormatType.Default);

MemoryStream stream = new MemoryStream();
excel.Save(stream, FileFormatType.AsposePdf);

Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
pdf.BindXML(stream, null);
pdf.Save("d:\\test\\abc.pdf"); // you can change this line of code to save the file to stream