Open CSV file without losing format

I have a CSV file with some formats(eg: leading with '0’s). When I open with excel, the format lost. Is it possible to keep the format when open csv file with Aspose.Cells for NET. Thanks

Hi William,

Thanks for your posting and using Aspose.Cells.

If you want to preserve leading zeros, then please set the TxtLoadOptions.ConvertNumericData=false while loading your csv file inside the workbook object.

Please see the following code. I have attached the output xlsx file generated by it for your reference.

C#


string filePath = @“F:\Shak-Data-RW\Downloads\sample.csv”;


TxtLoadOptions options = new TxtLoadOptions();

options.ConvertNumericData = false;


Workbook workbook = new Workbook(filePath, options);


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

Thanks. It works well

Hi William,


It is good to know that you are up & running again. Please feel free to write back in case you need our further assistance with Aspose APIs.