Board index » delphi » Force cells in Excel to use Text format rather than Number format
|
Andrew Fiddian-Green
Delphi Developer |
|
Andrew Fiddian-Green
Delphi Developer |
Force cells in Excel to use Text format rather than Number format2004-06-14 06:45:20 PM delphi161 Dear All, How does one force cells in Excel to use Text format rather than Number format? In my code below, if (say) aString is a numerical string (e.g. '417895240') and if the Excel column width is small, the cell value will display as 4E+08 rather than as 417895240 ... i.e. the NumberFormat := '@'; seems not to work. var theRange : Variant; ... theRange := VarArrayOf([aString, bString, cString]); Excel.Range[Format('A%u',[i]),Excel.Cells.Item[i,varArrayHighBound(theRange, 1)+1]].Value := theRange; Excel.Range[Format('A%u',[i]),Excel.Cells.Item[i,varArrayHighBound(theRange, 1)+1]].NumberFormat := '@'; Regards, AndrewFG |
| Deborah Pate (TeamB)
Delphi Developer |
2004-06-14 07:12:19 PM
Re:Force cells in Excel to use Text format rather than Number format
<<Andrew Fiddian-Green:
How does one force cells in Excel to use Text format rather than Number format? Quote> Deborah Pate (TeamB) delphi-jedi.org TeamB don't see posts sent via Google or ISPs Use the real Borland server: newsgroups.borland.com www.borland.com/newsgroups/genl_faqs.html |
| Andrew Fiddian-Green
Delphi Developer |
2004-06-14 08:13:12 PM
Re:Force cells in Excel to use Text format rather than Number format
Dear Deborah,
Do you mean the following? theRange := VarArrayOf([''''+aString, ''''+bString, ''''+cString]); Regards, AndrewFG "Deborah Pate (TeamB)" <XXXX@XXXXX.COM>wrote in message news:XXXX@XXXXX.COM... Quote<<Andrew Fiddian-Green: |
| Joe Griffin
Delphi Developer |
2004-06-15 04:08:20 AM
Re:Force cells in Excel to use Text format rather than Number format
Andrew Fiddian-Green writes:
QuoteHow does one force cells in Excel to use Text format rather than Number Member of the UK Borland User Group |
| Andrew Fiddian-Green
Delphi Developer |
2004-06-17 01:13:44 AM
Re:Force cells in Excel to use Text format rather than Number formatQuoteTry setting the format before you place the values into the cells. "Joe Griffin" <XXXX@XXXXX.COM>writes QuoteAndrew Fiddian-Green writes: |
