Aspose.cells - numbers are converted to date format

Hi,

I'm filling an xls sheet and the price column is formatted sometimes to date format - see attached xls file.

Code snippet:

Style style = worksheet.Cells[row, column].GetStyle();

style.Number = 2;

worksheet.Cells[row, column].SetStyle(style, true);

worksheet.Cells[row, column].PutValue(Convert.ToDouble(dr[i].ToString()));

Thanks for your help,

Nikolaus

Hi,

Please test it with the latest version:
Aspose.Cells
for .NET v7.0.4.3


I found it is working fine. Please see the sample code and the output file.

If the problem persists, then please provide us a simple runnable code replicating the problem. We will look into it and help you asap.

C#


//Create a workbook object

Workbook workbook = new Workbook();



Cell cellA1 = workbook.Worksheets[0].Cells[“A1”];

cellA1.PutValue(2);


Style style = cellA1.GetStyle();

style.Number = 2;

cellA1.SetStyle(style);


//Save the workbook

workbook.Save(filePath + “.out.xlsx”, SaveFormat.Xlsx);



I'm using version 7.0.4.0 which I downloaded from your website - where can I get 7.0.4.3?

thanks,

Nikolaus

Hi,

Please use the download link provided by me in the above post.

.... while preparing a code sample for you I found the problem in my code - thanks for your quick and excellent help.

- Nikolaus

Hi,

It’s good to know you were able to sort out this problem.

If you got any other question, please feel free to post it. We will help you asap.