Error converting excel file to pdf using Aspose.Cells for .net

Hi,



I am using Aspose.Cells for .net to generate html, excel and PDF reports.

I was able to generate html and excel reports without any problem. But, when I tried to generate the PDF report, I received the error as “File is damaged and could not be repaired.”



I created a method which returns the stream data and then I am viewing the data (report) on a different page using HttpResponse object.



public System.IO.Stream GetReport(string type)

{

System.IO.Stream s = new System.IO.MemoryStream();

InitializeAspose();

Workbook b = new Workbook();

Worksheet ws = b.Worksheets[0];


SetWorksheetColumnWidth(ws);

SetHeader(ws);

PushData(b, ws);

SetFooter(ws);

if (type.ToLower() == "excel")

b.Save(s, FileFormatType.Default);

else if (type.ToLower() == "pdf")

{

b.Save(s, FileFormatType.Pdf); //not working.

//b.Save(@"c:\\test.pdf", FileFormatType.Pdf); //this one is working fine. But I want the above method to work.

}

else if (type.ToLower() == "html")

b.Save(s, FileFormatType.Html);

s.Position = 0;

return s;

}



Thank You for your help!

Usha


This message was posted using Email2Forum by Laurence.

Hi,

Thank you for considering Aspose.

Please try the attached latest version of Aspose.Cells. We have supported to save generated PDF files to Stream in the attached version.

Please do let us know if you still face any problem.

Thank You & Best Regards,

Hi,

I tried the latest version of Aspose.Cells 4.7.0.2 and i am still getting the same error. I am using Adobe Reader 9 version 9.0.0. to view the report. What version of Adobe Reader it supports?

Thanks for your help!

Hi,

Thank you for considering Aspose.

Please create a sample application and post it here to reproduce the issue. We will check it soon.

Thank You & Best Regards,

Hi,

I am sorry; actually i got a different error message "Cannot access a closed Stream. "

I attached a copy of sample application which generates html, excel and pdf reports.

Thanks for your help!

Hi,

Thank you for sharing the sample application and generated files. We have found the issue after an initial test. We will provide a fix soon.

Thank You & Best Regards,

Hi,

Thank you for considering Aspose.

Please try the attached latest fix of Aspose.Cells. We have fixed your mentioned issue.

Thank You & Best Regards,

Hi,

Awesome! it worked.

Thank you so much for your help!

The issues you have found earlier (filed as 7726) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Amjad Sahi.