When I load a CSV file into Apose and then save it as an xlsx file, the date fields show up as numbers when viewed in Excel.
Hi,
Please provide us your xlsx file. We will investigate the problem.
Please also try the latest version:
Aspose.Cells
for .NET v6.0.1.4
Hi, I’ve attached both files for you to view. I’ve also tried it with 6.0.1.4 and got the same results.
Hi,
Please use the code below to set the column number 1 to display date correctly. I have attached the output file and screenshot.
C#
string path = @“F:\Shak-Data-RW\Downloads\test.csv”;
Workbook workbook = new Workbook(path);
Worksheet worksheet = workbook.Worksheets[0];
Style style = workbook.CreateStyle();
style.Custom = “dd-MM-yyyy”;
StyleFlag flag = new StyleFlag();
flag.All = true;
worksheet.Cells.Columns[1].ApplyStyle(style, flag);
worksheet.AutoFitColumn(1);
workbook.Save(path + “.out.xlsx”);
Screenshot:
Hi,
The problem is that I will not know ahead of time which columns would require a date-time format. I may open a CSV that may have three or four columns with date-time in various positions. Is there a way to get it to automatically format those columns to a date-time format? Or at least a way to know that that column has date-time values in it so that I can manually set the format?
Thank you!