I have an Excel workbook that I am outputting to PDF through an ASP.NET application using Aspose.Cells. When I output the workbook in Excel format (before saving to PDF using Aspose.Cells), Excel does not report any errors. However, when I use Cells to save the workbook to PDF, when I open the PDF document, I get an error message on the first page of the PDF that says “An error exists on this page. Acrobat may not display the page correctly. Please contact the person who created the PDF document to correct the problem.” I am somewhat at a loss to diagnose what the cause of the error could be, especially as Excel is not reporting any errors. I have attached a copy of the Excel worksheet for your review.
I still get the same error using version 7.0.3.6.
Hi,
Unfortunately I can’t give you the application, as we are using Software Artisans Excel Writer to generate the Excel file and I doubt that you have access to that. Basically, I save the excel file created by Excel Writer to a memory stream using the Excel Writer objects like so (where xlt is a an Excel Writer ExcelTemplate object):
MemoryStream xltStream = new MemoryStream();
xlt.Save(xltStream);
Then I create the Aspose.Cells workbook from the stream after evaluating all of the formulas and then hiding all of the pages except the first one like so:
Workbook wb = new Workbook(xltStream);
wb.CalculateFormula();
for (int i = 1; i < wb.Worksheets.Count; i++)
wb.Worksheets[i].IsVisible = false;
wb.Save(this.Response, “QuantSheet.pdf”, ContentDisposition.Attachment, new PdfSaveOptions());
If instead of sending the Excel stream to Aspose.Cells, I output it to the response object as an attachment, I end up with the Excel file that I attached in my initial post. I am attaching the corrupted PDF file here also for your review.
Hi,
Please save xltStream on disk and attach on this thread. We will look into it and update you asap.
Sure. Here it is.
Hi,
Thanks for your file stream.
I was able to reproduce the problem using the following code. I have attached all the source and output files.
I have attached the screenshot for a reference.
We have logged this issue in our database. We will look into it and fix the problem and update you asap.
This issue has been logged as CELLSNET-40203.
C#
string filePath = @“F:\Shak-Data-RW\Downloads\ExcelStream.txt”;
byte[] bytes = File.ReadAllBytes(filePath);
MemoryStream ms = new MemoryStream();
ms.Write(bytes, 0, bytes.Length);
ms.Position = 0;
Workbook workbook = new Workbook(ms);
workbook.Save(filePath + “.out.xlsx”);
workbook.Save(filePath + “.out.pdf”);
Screenshot:
Hi,
Please share your system environment like OS, language etc
We are unable to replicate this issue from scratch in our development system.
The issues you have found earlier (filed as CELLSNET-40203) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.