Value = null for cell with numeric format General.
Hi,
I have a problem to get single numeric values from an Excel worksheet (that I need to process as I receive it).
I use the Microsoft Excel 9.0 Library because I need to process EXcel 2000/2003 files.
This is the range:
Excel.Range CellRange = (Excel.Range) WS.Cells[RowNum, ColNum];
I use this statement to check format and cell.
MessageBox.Show(CellRange.NumberFormat.ToString() + "\n" + RowNum.ToString() + "\n" + ColNum.ToString());
Only in case of format 0.0 I can get a value (e.g. 234.9) like this:
Result = Convert.ToDouble(CellRange.Value);
MessageBox.Show(Result.ToString());
But the format can also be General with values e.g. 234.9 (with point), 234,9 (with comma) or 2349 (without separator).
The value property is null for a cell with numeric format General.
It must be simple, but I can't find the solution.
Who can help me?
Thanks,
Gijs
|