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 formating a cell/range

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





PostPosted: Wed Nov 12, 2003 8:51 pm    Post subject: Excel formating a cell/range Reply with quote



re: D7, Excel 2000

I'm attempting to simulate conditional formatting via automation. (The
reason why I say "simulate" is because Excel is limited to 3 conditional
formats, I believe.) and I'm trying to find the easiest way to do this,
naturally.

Ideally, I would like to read the text format of 6 cells which are named
ranges. Store the values in some variables and then format the range
depending upon each cell's value with one of the 6 format.

What I thought should be a simple issue is giving me a problem. I don't see
any way to simply access a named ranged text format. Is there a way to get
this information (as a record structure or interface), store it in a
variable (of what type) and then using that var's value, set the format of
another cell or range?

(I can copy and pastespecial - but that does not quite do it for me, for
it's not elegant enough.)

Thanks,
Karl






Back to top
Deborah Pate (TeamB)
Guest





PostPosted: Fri Nov 14, 2003 12:45 am    Post subject: Re: Excel formating a cell/range Reply with quote



< Ideally, I would like to read the text format of 6 cells
which are named ranges.
Quote:


What exactly do you mean by 'text format'?

--
Deborah Pate (TeamB) http://delphi-jedi.org

TeamB don't see posts sent via Google or ISPs
Use the real Borland server: newsgroups.borland.com
http://www.borland.com/newsgroups/genl_faqs.html



Back to top
Karl Thompson
Guest





PostPosted: Fri Nov 14, 2003 1:19 pm    Post subject: Re: Excel formating a cell/range Reply with quote




I need to know the color of the cell's font, weight (bold etc), size,
alignment.




"Deborah Pate (TeamB)" <d.pate (AT) blueyonder (DOT) co.not-this-bit.uk> wrote in
message news:VA.00001db2.020eb4bb (AT) blueyonder (DOT) co.not-this-bit.uk...
Quote:
Karl Thompson:
Ideally, I would like to read the text format of 6 cells
which are named ranges.


What exactly do you mean by 'text format'?

--
Deborah Pate (TeamB) http://delphi-jedi.org

TeamB don't see posts sent via Google or ISPs
Use the real Borland server: newsgroups.borland.com
http://www.borland.com/newsgroups/genl_faqs.html





Back to top
Karl Thompson
Guest





PostPosted: Fri Nov 14, 2003 1:31 pm    Post subject: Re: Excel formating a cell/range Reply with quote


Another way to look at this, when one does a PasteSpecial in Excel, one of
the options is "Formats". I want to capture all of the properties that go
into this concept of "format".

Background -

We have a workbook that has one sheet with a matrix made up of several
thousand cells (the size is dynamic) Another sheet has 6 named ranges made
up of one cell each. Each cell contains a different value and formatting.

I can write automation code which iterates through the matrix, reads the
value in each cell of the matrix and then checks each of the 6 named ranges
for a matching value. If it finds a match the code could do a copy and
PasteSpecial (formats) back to the particular cell in the matrix. It can do
that for each cell.

Not a very elegant solution.

What I would like to do is to read the "formats" of each of the 6 named
range cell and their corresponding values. The iterate through the matrix
and apply one of the six format to each cell (some cells have their formats
left as they are).

This is all being done to get around Excel's limitation of having 3
conditional formats.



"Deborah Pate (TeamB)" <d.pate (AT) blueyonder (DOT) co.not-this-bit.uk> wrote in
message news:VA.00001db2.020eb4bb (AT) blueyonder (DOT) co.not-this-bit.uk...
Quote:
Karl Thompson:
Ideally, I would like to read the text format of 6 cells
which are named ranges.


What exactly do you mean by 'text format'?

--
Deborah Pate (TeamB) http://delphi-jedi.org

TeamB don't see posts sent via Google or ISPs
Use the real Borland server: newsgroups.borland.com
http://www.borland.com/newsgroups/genl_faqs.html





Back to top
Deborah Pate (TeamB)
Guest





PostPosted: Fri Nov 14, 2003 5:21 pm    Post subject: Re: Excel formating a cell/range Reply with quote

< I need to know the color of the cell's font, weight (bold
etc), size, alignment.
Quote:


Right. I'm afraid you're stuck with reading each property
individually and storing the data somewhere.

--
Deborah Pate (TeamB) http://delphi-jedi.org

TeamB don't see posts sent via Google or ISPs
Use the real Borland server: newsgroups.borland.com
http://www.borland.com/newsgroups/genl_faqs.html



Back to top
Karl Thompson
Guest





PostPosted: Mon Nov 17, 2003 6:10 pm    Post subject: Re: Excel formating a cell/range Reply with quote

Quote:

Right. I'm afraid you're stuck with reading each property

individually and storing the data somewhere<<<<<

It had look to me that the 'Style' interface should be useful for this need.
But I didn't know where to start (basically because I'm not comfortable
working with interfaces). Is it not useful for this?






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.