We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

When cell value = 0- custom formatting not always applied

Hello,

I’ve attached an excel spreadsheet which has totals for each table, and they equal 0. They are formatted with custom cell format.
When saving as PDF, some of the totals with 0, is displayed as though they are negative eg. in RED (0.00) but then some of them are ok.
Could you please investigate why and is there something I can do about it?

Using this snippet:

Workbook workbook = new Workbook(“C:\profile_test.xls”);

//Save the document in PDF format
workbook.Save(“C:\profile_test.pdf”, SaveFormat.Pdf);

Version of Aspose.Cells: v7.5.1.0

Regards,
Philip

Hi Philip,

Thanks for your posting and using Aspose.Cells.

We were able to observe this issue after executing the following code and converting your source Excel file into PDF using the latest version: Aspose.Cells
for .NET v8.2.1.4
. Some of the 0 values are shown negative in red color.

We have logged this issue in our database for investigation. We will look into it and fix this issue. Once, the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as CELLSNET-43079.

I have also attached the output PDF and screenshot highlighting this issue for a reference.

C#


String filePath = @“F:\Shak-Data-RW\Downloads\profile_test.xls”;


Workbook workbook = new Workbook(filePath);


workbook.CalculateFormula();


workbook.Save(filePath + “.out.pdf”);

Hi,

Thanks for using Aspose.Cells.

We have looked into this issue further and found that this issue is caused by precision of C#.

Please try the following code:


double a = -0.45;//F36

double b = 0.43;//F39

double c = a + b;//

double d = 0.02;//F40

double e = c + d;//F41


The value of c is -0.020000000000000018, not -0.02. So the result of F41 is not zero.

We will look into it and see how to work as MS Excel.

Thank you for the update so far.

Hi Philip,

Thanks for your posting and using Aspose.Cells.

Sure, we will keep you updated with any other news or a fix when it is available for your testing.