I am trying to generate a PDF from excel template. When I open the excel template from MS Excel and simply save it and generate the PDF then the Value appears in both PDF and excel Template . But without opening the same template when I try to create PDF then in place of value, #N/A appears in both pdf and excelTemplate(see 12th row of Staging sheet in excelTemplate.xlsx).
Steps to follow:
Without opening the excel file(excelTemplate.xlsx) attached here try to generate the PDF then, #N/A appear in PDF.
Open the template and simply save it and try to generate PDF then, value appears in PDF. Code used:
Workbook workbook = new Workbook(io);
workbook.calculateFormula();
workbook.save(“myresult.pdf”); // i have used Display sheet of excelTemplate.xlsx to generate pdf
The excel file is attached with this post resourceUsed.zip (103.9 KB)
(14.4 KB)
in zip format
I do not think if this is an issue with Aspose.Cells APIs by any means or even the issue is linked with the APIs. I opened your template file into Ms Excel 2007/2013 manually and check the row, it gives same error “#N/A” value into those cells, I even calculate the formulas again and again (I also double clicked in the row cells and pressed enter, etc. but the value is not changed). See the screenshot for your reference:
I then re-saved the file with new file name, the value is not changed too. Then I re-saved to PDF file format (the PDF remains the same as per the original file with those “#N/A” error values in that row).
In short, this is not an issue with Aspose.Cells. I guess there is something wrong with your template file especially with formula references. If you still think it is an issue with Aspose.Cells APIs, kindly provide more details and steps involved on how we can see MS Excel behaves different than Aspose.Cells rendered PDF file format, we will check it soon.
Amjad, can you please open that template from MS Excel 16.365. We are seeing values in place of #N/A. This seems like there is issue from MS excel 2007 and 2013.
@niteshregmi1234,
Yes, you are right that it shows proper value when opened in Excel 16.
We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.
This issue has been logged as
CELLSJAVA-42971 – N/A is shown in the rendered PDF
We have fixed some issues of calculating formulas in your template file. However, because of bugs in old JDK versions for processing IEEE 754 double values, to calculate all formulas correctly with the coming fix (we will share the Download link in the next few days), JDK1.8 or later versions are required.
The issues you have found earlier (filed as CELLSJAVA-42971) have been fixed in Aspose.Cells for Java v19.8. This message was posted using BugNotificationTool from Downloads module by ahsaniqbalsidiqui
I have tested your scenario/ case using the following sample code with original template file (attached to the first post in the thread) using Aspose.Cells for Java v20.4.5, it works fine and as expected. See the attached output file for your reference:
e.g Sample code:
Workbook workbook = new Workbook("f:\\files\\excelTemplate.xlsx");
workbook.calculateFormula();
workbook.save("f:\\files\\Asposeresult.pdf");
If you still find any issue with Aspose.Cells for Java v20.4.5, kindly do attach your template file, output PDF and sample code to reproduce the issue, we will check it soon. Asposeresult.pdf (145.2 KB)
@HThagunna,
You are welcome and take your time to test this latest fix. Please note that official release Aspose.Cells for Java 20.5 is also released and can be downloaded using Mavan or download section as follows: