The Leading Zero removed

Hi

We have some issue about leading zero.

Our code as following:

_workbook = new Workbook {Settings = {**ConvertNumericData = false** , Encoding = System.Text.Encoding.Default}}; _workbook.Open(this.CurrentFileName, CurrentFileType);

There is a little chance that the leading zero is moved. Most time the function works fine. Is this an issue of your end or we do something wrong in the code?

Please kindly advise. thanks so much.

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

Since you are using quite an older version of Aspose.Cells, we strongly recommend you to download and use the latest version:
Aspose.Cells
for .NET v7.2.0.7



For your leading zero problem while loading the workbook, you will have to set LoadOptions.ConvertNumericData=false.

Please see the code below. I have also attached the sample.csv file used in this code and the screenshot. Please also see the output.

C#


string filePath = @“F:\sample.csv”;


LoadOptions opts = new LoadOptions();

opts.ConvertNumericData = false;


Workbook workbook = new Workbook(filePath, opts);


Worksheet worksheet = workbook.Worksheets[0];


Cell cellA1 = worksheet.Cells[“A1”];

Cell cellB1 = worksheet.Cells[“B1”];


Console.WriteLine(cellA1.StringValue);

Console.WriteLine(cellB1.StringValue);


Output:
000012345
0001234777

Screenshot: