Skip to content

Export To Excel In Xlsx Format.

Dharmapriya

Asked Apr 19, 2015, 9:01 PM EDT2 answers
Share
LinkedInX
Here I m trying to export  a excel sheet  with .xlsx format  and that also formated but when i opn excel that tell me convert to number in excel sheet 
.
please help me 
.

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • shi  lianghong
    0
    What is the meaning of "convert to number"?Can u provide more?
    0
  • 0
    If I understood you correctly your problem is that you have a file with some number values and when you open that file in MS Excel it gives you a little warning that says:
    "The number in this cell is formatted as text or preceded by an apostrophe."
    Well the warning is self explanatory, the problem is that your numbers are written in the XLSX file as a plain text.
    Now unfortunately I don't know how you are writing your XLSX files but the solution to this is that you would need to apply some number formatting to that cell.
    For example you can use this C# tool for excel files in order to achieve that.
    You would either create a new or read an existing excel file in C# and you would set the required cell value to a number like the following:
    C#
    ExcelFile file = new ExcelFile();
    ExcelWorksheet sheet = file.Worksheets.Add("Sheet1");
     
    double sampleNumber = 123.45;
    sheet.Cells["A1"].SetValue(sampleNumber);
     
    file.Save("Sample.xlsx");
    0