We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Number writte as text format

hi,



i am trying to write number to excel.

the column formated as below

Style colStyle = sheet.Cells.Columns[colIndex].Style;
StyleFlag flag = new StyleFlag();
flag.NumberFormat = true;
//Set the formating on the as text formating
colStyle.Number = 1;
sheet.Cells.Columns[colIndex].ApplyStyle(colStyle, flag);

and i am writing int type

in excel i receive the number with green triangle that saying : number sorted as text
and below convert to number.

how do i write it as text from the beginning

Thanks

shemesh

Hi,


Well, MS Excel will show this message when you have inserted numbers as strings. I think you may try to use an overloaded version of Cell.PutValue method, e.g
Cell.PutValue(stringval, true); //Please specify true for the second parameter (bool isConverted).
e.g
cell.PutValue(“123”, true);

Now, the cell would have numeric data and you don’t get the message (“Numbers stored as text”) in MS Excel.

Alternativley, to eliminate this info error, you need to uncheck that option manually in MS Excel. e.g… in MS Excel 2003, click menu option… Tools|Options|Error Checking tab, now uncheck the checkbox i.e…, “Number stored as text” and everything will be fine.

Thank you.