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 

Changing the colour of a Excel cell's font, not using a Rang

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





PostPosted: Fri May 18, 2007 2:36 am    Post subject: Changing the colour of a Excel cell's font, not using a Rang Reply with quote



Hi
Is there any way to change the attributes of a cells font without using is
'range' or the cell being the 'activecell'?

My problem is that I am filling a worksheet using the contents of a string
grid, this works fine, I would now like to change the colour of some
selected cells during this loading process. If I have to use Range (which
are the only examples I have seen) to do this then I have to know what
character to append to the row and column i.e. WS.Range[F1, F1].Font.Color
:= clRed; . I am using WS.Cells.Item[Row, Col].Value := 'My Value'; to add
the value in the loop.

Ideally, I would like to use the Row and Col values to access the cell I
want to change the font's attributes.

Any help would be good.

thanks
daryl
Back to top
Oliver Townshend
Guest





PostPosted: Fri May 18, 2007 1:11 pm    Post subject: Re: Changing the colour of a Excel cell's font, not using a Reply with quote



Can't you just say selection.font.color:=clRed?

Oliver Townshend
Back to top
Mike Shkolnik
Guest





PostPosted: Sat May 19, 2007 1:02 am    Post subject: Re: Changing the colour of a Excel cell's font, not using a Reply with quote



Use the next syntax:
WS.Cells.Item[Row, Col].Font.Color := ColorToRGB(yourColor)
WS.Cells.Item[Row, Col].Font.Interior.Color :=
ColorToRGB(yourBackgroundColor);
--
With best regards, Mike Shkolnik
Scalabium Software
http://www.scalabium.com
mshkolnik (AT) scalabium (DOT) com

"Daryl" <devaccount (AT) hotmail (DOT) com> wrote in message
news:464ccadc (AT) newsgroups (DOT) borland.com...
Quote:
Hi
Is there any way to change the attributes of a cells font without using is
'range' or the cell being the 'activecell'?

My problem is that I am filling a worksheet using the contents of a string
grid, this works fine, I would now like to change the colour of some
selected cells during this loading process. If I have to use Range (which
are the only examples I have seen) to do this then I have to know what
character to append to the row and column i.e. WS.Range[F1, F1].Font.Color
:= clRed; . I am using WS.Cells.Item[Row, Col].Value := 'My Value'; to add
the value in the loop.

Ideally, I would like to use the Row and Col values to access the cell I
want to change the font's attributes.

Any help would be good.

thanks
daryl


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.