I need help with the Excel Range collection and cell formatting using Automation.
Posted on 2006-07-04
I am trying to import an excel price list of books into my Delphi Application, the excel file is using custom formatting on each cell containing an ISBN number the formatting used is: (0000000000). In excel it displays the correct results ie: 0072226803.
When I access the cell using
it returns: 72226803, this throws the validation out because an ISBN number must be 10 characters in length and the first two zeros have gone AWOL.
How would I access the cells value and preserve the leading zeros? Keep in mind that the Spreadsheets differ from supplier to supplier so their ISBN columns may have different formatting, ultimately I want to access the value as its seen on the spreadsheet...
Most of the documentation shows the Cells collection being accessed as follows:
My problem is that with the Excel_TLB, the only way to access an individual cell by row, col is with the Item property and this returns an OleVariant which pretty much only contains the cells content. How would I access other properties for an individual cell?
Any help on this will be greatly appreciated!