BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Convert to number in excel from delphi

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation
View previous topic :: View next topic  
Author Message
LukaM
Guest





PostPosted: Wed Apr 25, 2007 2:24 pm    Post subject: Convert to number in excel from delphi Reply with quote



I'm transfering data from delphi with sql into excel worksheet, and numbers
in cells are beeing stored as text (I can correct them in Excel with
Tools>Error checking, or to select cell range and clicking on the yellow
exclamation sign and then Convert to number).
I need to select cell range and convert it to number from Delphi.
Back to top
Krisztian Pinter
Guest





PostPosted: Wed Apr 25, 2007 4:24 pm    Post subject: Re: Convert to number in excel from delphi Reply with quote



On Wed, 25 Apr 2007 11:24:02 +0200, LukaM <luka.matijevic (AT) presoflex (DOT) hr>
wrote:

Quote:
I'm transfering data from delphi with sql into excel worksheet, and
numbers
in cells are beeing stored as text (I can correct them in Excel with
Tools>Error checking, or to select cell range and clicking on the yellow
exclamation sign and then Convert to number).
I need to select cell range and convert it to number from Delphi.

i don't know what method you are using, but i recommend the following

1. create a variant array with VarArrayCreate, type varVariant
2. populate with data, using correct types
3. put the whole array at once into excel with Range[].Data := YourArray;

this is the fastest and more reliable way.
Back to top
Oliver Townshend
Guest





PostPosted: Wed Apr 25, 2007 5:32 pm    Post subject: Re: Convert to number in excel from delphi Reply with quote



Quote:
I'm transfering data from delphi with sql into excel worksheet, and
numbers in cells are beeing stored as text (I can correct them in Excel
with Tools>Error checking, or to select cell range and clicking on the
yellow exclamation sign and then Convert to number).

Use the .value2 property rather than .value

Oliver Townshend
Back to top
Mike Shkolnik
Guest





PostPosted: Thu Apr 26, 2007 12:46 am    Post subject: Re: Convert to number in excel from delphi Reply with quote

Use the NumberFormat property for range (applied to cell, column etc)Neutral
yourCellRange.NumberFormat := '0.00'

--
With best regards, Mike Shkolnik
Scalabium Software
http://www.scalabium.com
mshkolnik (AT) scalabium (DOT) com

"LukaM" <luka.matijevic (AT) presoflex (DOT) hr> wrote in message
news:462f1e0b (AT) newsgroups (DOT) borland.com...
Quote:
I'm transfering data from delphi with sql into excel worksheet, and
numbers
in cells are beeing stored as text (I can correct them in Excel with
Tools>Error checking, or to select cell range and clicking on the yellow
exclamation sign and then Convert to number).
I need to select cell range and convert it to number from Delphi.

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.