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 

Excel Fill Color from Delphi

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





PostPosted: Sun May 13, 2007 3:00 am    Post subject: Excel Fill Color from Delphi Reply with quote



Hello,

Can someone please provide an example or tell me how to change the fill
color for a cell / row / column in Excel from Delphi.

Thanks in advace,
Glenn
Back to top
Oliver Townshend
Guest





PostPosted: Sun May 13, 2007 5:37 am    Post subject: Re: Excel Fill Color from Delphi Reply with quote



Quote:
Can someone please provide an example or tell me how to change the fill
color for a cell / row / column in Excel from Delphi.

The simplest way to work these things out is to either search google for
examples or to record a macro:

With Selection.Interior
.ColorIndex = 8
.Pattern = xlSolid
End With

So in Delphi, it's

with WS.Selection.Interior begin
ColorIndex :=8;
Pattern := xlSolid;
end;

I searched for interior in the Excel Object Browser and found that it's also
a property of a range. The example they give is:

Worksheets("Sheet1").Range("A1").Interior.ColorIndex = 3

So this can be translated fairly easily too.

Oliver Townshend

Oliver Townshend
Back to top
Mike Shkolnik
Guest





PostPosted: Sun May 13, 2007 5:44 pm    Post subject: Re: Excel Fill Color from Delphi Reply with quote



xls.ActiveSheet.Cells[yourRow, yourCol].Interior.Color :=
ColorToRGB(yourColor);
or
xls.ActiveSheet.Columns[yourColumn+i].Interior.Color :=
ColorToRGB(yourColor);
or
xls.ActiveSheet.Rows[yourRow+i].Interior.Color := ColorToRGB(yourColor);

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

"Glenn P" <glenn.parisi (AT) london (DOT) net> wrote in message
news:46463906$1 (AT) newsgroups (DOT) borland.com...
Quote:
Hello,

Can someone please provide an example or tell me how to change the fill
color for a cell / row / column in Excel from Delphi.

Thanks in advace,
Glenn

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.