| View previous topic :: View next topic |
| Author |
Message |
Karl Thompson Guest
|
Posted: Wed Nov 12, 2003 8:51 pm Post subject: Excel formating a cell/range |
|
|
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
|
Posted: Fri Nov 14, 2003 12:45 am Post subject: Re: Excel formating a cell/range |
|
|
<
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
|
Posted: Fri Nov 14, 2003 1:19 pm Post subject: Re: Excel formating a cell/range |
|
|
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...
|
|
| Back to top |
|
 |
Karl Thompson Guest
|
Posted: Fri Nov 14, 2003 1:31 pm Post subject: Re: Excel formating a cell/range |
|
|
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...
|
|
| Back to top |
|
 |
Deborah Pate (TeamB) Guest
|
Posted: Fri Nov 14, 2003 5:21 pm Post subject: Re: Excel formating a cell/range |
|
|
<
I need to know the color of the cell's font, weight (bold
etc), size, alignment.
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
|
Posted: Mon Nov 17, 2003 6:10 pm Post subject: Re: Excel formating a cell/range |
|
|
| 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 |
|
 |
|