Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
unable to get original cell value from a "number stored as text"
I am running against a little issue. I have an excel spreadsheet, that I need to be able to read in C#. No problem there. The issue is that the system creating the spreadsheet uses a particular trick to format a number, so that the leading "0" is intact and displays. For example, the system writes a '02.7 so that excel displays 02.7.
When I travers the Range and read the value of the cell in c# or even the VBA Macro editor built into Excel, I get the numerical 02.7. I do not get the text (with leading apostrophe) '02.7. I need the full text. Does anyone know how excel stores the original data in the cell and how to get it back. I noticed that there is a little green triangle in the top, left corner of the cell. This has an error called "Number Stored as Text" I have tried looking at the range's error object with no luck. Here is how I am getting the value in c Excel.Range rngCurrent = exlRange.get_Range("B3", System.Reflection.Missing.Value); rngCurrent.Value2.ToString() Thanks!! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
unable to get original cell value from a "number stored as text"
Can you infer the apostrophe if the first character is"0". Perhaps using
the IsNumeric function to make sure it's not alphanumeric? -- Jim Rech Excel MVP "cedralpass" wrote in message ... |I am running against a little issue. I have an excel spreadsheet, that I need to be able to read in C#. No problem there. The issue is that the system creating the spreadsheet uses a particular trick to format a number, so that the leading "0" is intact and displays. For example, the system writes a '02.7 so that excel displays 02.7. | | When I travers the Range and read the value of the cell in c# or even the VBA Macro editor built into Excel, I get the numerical 02.7. I do not get the text (with leading apostrophe) '02.7. I need the full text. Does anyone know how excel stores the original data in the cell and how to get it back. I noticed that there is a little green triangle in the top, left corner of the cell. This has an error called "Number Stored as Text" I have tried looking at the range's error object with no luck. | | Here is how I am getting the value in c# | Excel.Range rngCurrent = | exlRange.get_Range("B3", System.Reflection.Missing.Value); | | rngCurrent.Value2.ToString(); | | Thanks!! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
unable to get original cell value from a "number stored as text"
Unfortunately we can not loop through each cell, as these worksheets are very large. We are sucking out the data in bulk. Calliing a function each time would be very time consuming. When looping through each cell in a worksheet, extraction of the data takes over 2-3 minutes on a very fast box.
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
"Find" a wildcard as a place marker and "replace" with original va | Excel Discussion (Misc queries) | |||
Pasted values that paste as "number stored as text" | Excel Discussion (Misc queries) | |||
Text stored in a cell is displayed as a string of "#####..." | Excel Discussion (Misc queries) | |||
EXCEL - unable to get "TEXT" to wrap, even though cell is formatte | Excel Worksheet Functions | |||
How do I ignore the "Number stored as text" error message permane. | Excel Discussion (Misc queries) |