Problem with custom formatting of text values when exporting to PDF

I am using the custom format string “#,##0.0__;-#,##0.0__;0.0__;—__” in my Excel template for some data that I want to output. Some of the data I am outputting is numeric and some of it is text. From my custom format string that I defined, I would expect that my text data output would appear as “—” with two blank spaces to the right. Excel is displaying the text data correctly, but when I export the workbook to PDF, I see the actual text instead of “—”.

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

Please download and use the latest version:
Aspose.Cells
for .NET v7.1.2.2

and let us know your feedback.

If the problem still occurs, then please provide us your sample runnable project to replicate this issue.

That new version doesn’t work for me. I get the following error message
when I attempt to include a reference to the dll in my code (I have
verified that I built with version 7.1.2.2):



Could not load file or assembly ‘Aspose.Cells, Version=7.1.2.0,
Culture=neutral, PublicKeyToken=716fcc553a201e56’ or one of its dependencies.
The located assembly’s manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)




I have reverted to the previous 7.1.2.0 version, and I am attaching
versions of my Excel and PDF documents so that you can see the error. (Actually it’s 2 errors.)

The first error is in the June 2004 value in the top data table. Note that in the excel output it is correctly displaying as 0.0 but in the pdf output it is displaying as -0.0.

The second related error (I am assuming also having to do with the pdf output not picking up on the excel cell formatting) is that my NULL data values are being correctly formatted as “—” by excel but in the PDF output they are being shown as NULL.

Hi,


For the issue using the latest fix v7.1.2.2:
Could not load file or assembly ‘Aspose.Cells, Version=7.1.2.0, Culture=neutral, PublicKeyToken=716fcc553a201e56’ or one of its dependencies"

This error seems to be relating to assembly references. Will you please check all the references in your project(s) are referring to new v7.1.2.2 so, you may update all of them accordingly? If you have any assembly in GAC referencing to v7.1.2.0 still, then you should also remove it too.
Also, check if your previous Aspose.Cells v7.1.2.0 has any reference to your project, so, you need to remove all the older references first and then you should re-built your application.

Now come to your mentioned issue, I have tested your case and converted your attached template file to PDF, I did find the issue “”—” by Excel but in the PDF output they are being shown as NULL". For your other issue “0.0 is displayed as -0.0”, I could not find it, the values are actually in “-0.x” format in MS Excel (I have checked opening your file into MS Excel 2007). Anyways, I have logged a ticket with an id: CELLSNET-40505. for your issue. We will soon look into your issue to resolve it.

Thank you.

You don’t see the “-0.0” value for June 2004 in the returns table at the top of the PDF and “0.0” in the corresponding value in the Excel spreadsheet? I don’t know if it makes a difference but I am using Excel 2010. Also, I checked the advanced option “Set precision as displayed” in my excel template and it’s picking that up for me when I open the excel file. If you uncheck this option you will see a "-0.0 in the Excel spreadsheet as well. I will attempt linking to the 7.1.2.2 and will let you know if I find a difference, but I suspect it will still have the same issue.

Hi,


Thanks for providing us further details about “-0.0” issue.

Well, I have tested with your template file and it works fine regarding your mentioned “-0.0” issue with latest version/fix: Aspose.Cells for .NET v7.1.2.3
I have also attached the output PDF here.

Thank you.

Could there be something you are doing differently between going directly from the in-memory version of the Excel spreadsheet to PDF compared to going from an actual Excel file to PDF? Because even with the latest version 7.1.2.3 I am still getting the “-0.0” in the PDF output for June 2004.

Hi,


Well, I use the simplest code converting your attached template Excel file to save to PDF format.

Sample code:

Workbook wb = new Workbook(@“e:\test2\14335.xls”);
wb.Save(“e:\test2\out_14335.pdf”, SaveFormat.Pdf);

The output file is already attached in my previous reply/post in the thread.

By the way, here is my system configurations.
OS: Win 7.0
.NET framework: 3.5
Excel: MS Excel 2007/2010

Also, could you attach your output PDF file after using my above mentioned code with your previous template file.

Thank you.

Yes, it also works fine for me when opening the spreadsheet directly, but when working with the spreadsheet in-memory (without actually saving it to disk first) and then exporting to PDF, I am still getting the “-0.0” in the output. Here is the logic I use to export the in-memory workbook to PDF that I modified to use the excel file instead as input. If you use this sample code below you should see the “-0.0” when you export it to PDF:

Workbook wb = new Workbook(@“e:\test2\14335.xls”);
//evaluate worksheet formulas (otherwise they won’t be represented in the pdf output)
wb.CalculateFormula();
//make all sheets invisible except for the first worksheet
for (int i = 1; i < wb.Worksheets.Count; i++)
wb.Worksheets[i].IsVisible = false;
wb.Save(this.Response, “QuantSheet.pdf”, ContentDisposition.Attachment, new PdfSaveOptions());

Maybe the problem’s in “CalculateFormula”. Anyway, if you use this test code you should be able to see the problem.

Hi,


Yes, it looks like an issue with Workbook.CalculateFormula() method. If I call this method before saving to PDF document, I can notice the issue as you pointed out for “-0.0” value.

I have logged a separate ticket with an id: CELLSNET-40515. We will look into it soon.

Thank you.

Hi,

Please download and try this fix: Aspose.Cells for .NET v7.1.2.4

But we are still working on right alignment.

Yes I see the -0.0 is no longer an issue but the “—” values are not aligned properly. I’m assuming this is what you were referring to. Just let me know when that part is fixed as well. Thanks.

Any update yet on the right-alignment issue? We won’t be able to release this to production until all of the formatting issues are worked out.

Hi,

We are working on rebuild convert object to string value with number format.


You should wait for this feature.

Also, I have logged your comment in our database against the issue id: CELLSNET-40505

Hi,


We have fixed this issue. Please download and try the latest version: Aspose.Cells for .NET v7.1.2.7

Well, I didn’t have to wait long! :slight_smile: Thanks for the quick turn around on this. Works perfectly.

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


This message was posted using Notification2Forum from Downloads module by aspose.notifier.