StringValue/DisplayStringValue converting Text to Scientific Notation

Hi - I’m using Aspose.Cells to read a file a tab delimited Text file and the Cells.StringValue and Cells.DisplayStringValue are both returning a string value for a phone number as scientific notation.


Input:
160710005418292

Output
1.61E+14

How can I keep the data formatted as Text? I've formatted the column as Text? I've attached a sample input file.

Hi,


Thanks for providing us template file and details.

I have evaluated your scenario/ case a bit and noticed scientific notation value when I used Cell.StringValue or Cell.DisplayStringValue attributes. But Cell.Value.ToString() would give you valid results as per your requirements, so, please try it. See the sample code below that gives your desired results for your underlying file:
e.g
Sample code:

LoadOptions lo = new LoadOptions(LoadFormat.TabDelimited);
Workbook workbook = new Workbook(“e://test2//gl_total_201604_2410300.csv”, lo);
Aspose.Cells.Cell cell = workbook.Worksheets[0].Cells[“M2”];
Console.WriteLine(cell.Value.ToString());//160710005418292

Hope, this helps a bit.

Thank you.

Hi,


We have evaluated your issue further.
We think if you could specify format the column (of phone number) as custom
pattern “0” instead of text, it would give your expected results. See the updated code segment that works fine:
e.g
Sample code:

LoadOptions lo = new LoadOptions(LoadFormat.TabDelimited);
Workbook workbook = new Workbook(“e://test2//gl_total_201604_2410300.csv”, lo);

Style style1;
StyleFlag flag1;

style1 = workbook.CreateStyle();
//Specify the custom “0” pattern instead of text.
style1.Custom = “0”;
flag1 = new StyleFlag();
flag1.NumberFormat = true;

//Apply style to the specified column.
workbook.Worksheets[0].Cells.ApplyColumnStyle(CellsHelper.ColumnNameToIndex(“M”), style1, flag1);
Aspose.Cells.Cell cell = workbook.Worksheets[0].Cells[“M2”];

Console.WriteLine(cell.Value.ToString());
Console.WriteLine(cell.StringValue);
Console.WriteLine(cell.DisplayStringValue);


Output:
160710005418292
160710005418292
160710005418292

Thank you.