Custom Formatting Issue

Hello,

We use Aspose.Cells to deal with lots of formattings, and we found it does not support custom format very well. Here is a bug we recently discovered.

In Excel, I have 2 cells valued 6,113 and -6,113, with custom format "#,##0.0,;(#,##0.0,)". Excel shows correctly result: 6.1 and (6.1). But when I open Excel file with Aspose, I got stringvalue as 6.1 and (6,113). I think Aspose cannot handle format on negative numbers.

I wonder if I can get a fix ASAP since it is an urgent client issue. Besides, I'd like to get both .Net 1.1 and 2.0 versions since our application supports both.

Thanks.

William Ren

Clarity Systems

Hi,

Which version do you user?

I tested this issue with "#,##0.0;(#,##0.0)", it works fine. I got got stringvalue as 6.1 and (6.1).

Please post your template file,we will check it soon.

Hello,

I am using Aspose.Cells 4.4.1.0 on Excel 2003. If you notice, the format string you used is different with mine. Mine has "," as suffix, which is supposed to do rounding on thousand.Somehow rounding doesn't work on negative number.

William Ren

Hi,

If i use "#,##0.0,;(#,##0.0,)" in Excel, I only get 0.0 and (0.0). Could you create a file and post here? We will check it soon.

Hi,

Instead of putting values 6.1 and -6.1 in cells (that is the reason you got 0.0), you should enter values as 6113 and -6113.

William Ren

Hi William Ren,

Thanks for providing details

Please try the attached fix (4.4.1.13), it will resolve the issue as we have tested.

Sample Test Code:

Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook();
Worksheet worksheet = workbook.Worksheets[0];
Cells cells = worksheet.Cells;
cells["A1"].PutValue(6113);
cells["A2"].PutValue(-6113);
cells["A1"].Style.Custom = "#,##0.0,;(#,##0.0,)";
cells["A2"].Style.Custom = "#,##0.0,;(#,##0.0,)";
Console.WriteLine(cells["A1"].StringValue); // output: 6.1
Console.WriteLine(cells["A2"].StringValue); // output: (6.1)

Thank you.

Hi Amjad,

Thanks for your support.

Could you please send me .Net 2.0 version as well?

Thank you.

William Ren

Hi,

The version which I attached previously is compiled on .NET 1.x and will work fine on any platform / framework. Any how, we will provide .NET 2.0 version soon.

Thank you.

Hi,

Please try this fix for Net2.0