Reputation: 29
I am exporting excel using openxml, I have a scenario to show a column with data "0001" for that I used below code,
c = new Cell();
c.DataType=CellValues.String;
c.CellValue = new CellValue("0001");
While opening excel my cell contains the value as I expected ("0001"). But after selecting the cell and move out from the same, the value changes from "0001" to "1". In excel the cell type is "General" instead of text.
How can I fix this
Upvotes: 0
Views: 385
Reputation: 4077
Can you try giving an apostrophe '
in front of the value, like this:
c = new Cell();
c.DataType=CellValues.String;
c.CellValue = new CellValue("'0001");
^^
Upvotes: 0