[Powerpoint] How to get a shape's background color?

D

Daniel Kirsch

I want to get the background color of a shape from a powerpoint slide.
I've found two shape properties: "forecolor" and "backcolor".

For most transparent textboxes in my ppt file "backcolor" always
returns the color value for "white" (#ffffff) and "forecolor" returns
"#00cc99". However the textbox actually doesn't have any background
color set - it is transparent.

What am I doing wrong? How do I get correct color or find out, if the
background is transparent?

Thanks
Daniel
 
S

Steve Rindsberg

I want to get the background color of a shape from a powerpoint slide.
I've found two shape properties: "forecolor" and "backcolor".

For most transparent textboxes in my ppt file "backcolor" always
returns the color value for "white" (#ffffff) and "forecolor" returns
"#00cc99". However the textbox actually doesn't have any background
color set - it is transparent.

What am I doing wrong? How do I get correct color or find out, if the
background is transparent?

In this case, background doesn't mean background.

Backcolor is only used when you apply a patterned fill to the shape. The
pattern is in ForeColor, the rest is in backcolor.

Otherwise the shape color is Forecolor; transparency is a separate property
that doesn't affect fill color:

With ActiveWindow.Selection.ShapeRange(1)
Debug.Print .Fill.ForeColor
Debug.Print .Fill.Transparency
End With
 
D

Daniel Kirsch

Steve said:
Backcolor is only used when you apply a patterned fill to the shape. The
pattern is in ForeColor, the rest is in backcolor.

Otherwise the shape color is Forecolor; transparency is a separate property
that doesn't affect fill color:

With ActiveWindow.Selection.ShapeRange(1)
Debug.Print .Fill.ForeColor
Debug.Print .Fill.Transparency
End With

Steve, thanks for that info. (I was on vacation so my answer is a bit
delayed :)

I get the following values:
Transparency : 0.0
ForeColor : #00cc99
BackColor : #ffffff
TextureType : -2
Pattern : -2

But when viewed in Powerpoint my object has no background at all so
other objects behind are visible.

Am I missing something?
Daniel
 
D

Daniel Kirsch

Daniel said:
I get the following values:
Transparency : 0.0
ForeColor : #00cc99
BackColor : #ffffff
TextureType : -2
Pattern : -2

Type : 1 (msoFillSolid)

All these properties are identical for my objects no matter if they
actually have a background color (ForeColor) or not.

I still havn't found a way to distinguish between objects with a colored
background and no background (transparent).

Daniel
 
S

Steve Rindsberg

Type : 1 (msoFillSolid)

All these properties are identical for my objects no matter if they
actually have a background color (ForeColor) or not.

I still havn't found a way to distinguish between objects with a colored
background and no background (transparent).

Again, the BackColor.RGB has no effect on anything UNLESS you've chosen a
patterened fill type.

It's the .Transparency value that determines whether a fill is transparent or
not and to what degree.

What puzzles me is that 00cc99 value. I don't think that's legit.
 
D

Daniel Kirsch

Steve said:
It's the .Transparency value that determines whether a fill is transparent or
not and to what degree.

I want to convert a slide into HTML. I don't mean opacity (which has a
value from 0 to 1) but I mean the css color value "transparent" for the
backgroundColor. Sorry for this confusion.

All my objects in the powerpoint presentation have a
Shape.Fill.Transparency value of 0.0 both the ones with a solid fill
color and those with no fill color (transparent in the CSS sense).

What puzzles me is that 00cc99 value. I don't think that's legit.

I think I've found the reason for this special value:
A shape's ForeColor property seems to inherit from the DefaultShape
(Presentation.DefaultShape.Fill.ForeColor) At least the 00cc99 value is
the DefaultShape's ForeColor value (well, the original value is 10079232
which I convert to 00cc99).

When exporting to html from Powerpoint[1] the export contains the color
values as well but transparent objects have an additional attribute
filled="f"
which seems to cause the fillcolor not to be used.

Which Shape or Fill property could cause this filled attribute?

Thanks
Daniel


[1] Example of an exported transparent shape:

<v:shape
id="_x0000_s24618"
type="#_x0000_t202"
style='position:absolute; left:168pt; top:258pt; width:468pt;
height:84.25pt'
filled="f"
fillcolor="#0c9 [4]"
stroked="f"
strokecolor="black [1]">
</v:shape>
 
S

Steve Rindsberg

I want to convert a slide into HTML. I don't mean opacity (which has a
value from 0 to 1) but I mean the css color value "transparent" for the
backgroundColor. Sorry for this confusion.

All my objects in the powerpoint presentation have a
Shape.Fill.Transparency value of 0.0 both the ones with a solid fill
color and those with no fill color (transparent in the CSS sense).

OK, back up then. This is the first you've mentioned about HTML/CSS or that the
values you're quoting are from HTML. We're talking two entirely different
languages here. No wonder we're confused. ;-)
I think I've found the reason for this special value:
A shape's ForeColor property seems to inherit from the DefaultShape
(Presentation.DefaultShape.Fill.ForeColor) At least the 00cc99 value is
the DefaultShape's ForeColor value (well, the original value is 10079232
which I convert to 00cc99).

When a new shape is created in PPT, it does inherit the presentation's defaults
for new shapes, which include fill color and a host of other attributes, yes.
When exporting to html from Powerpoint[1] the export contains the color
values as well but transparent objects have an additional attribute
filled="f"
which seems to cause the fillcolor not to be used.

Which Shape or Fill property could cause this filled attribute?

I'm not seeing that here; have played with fills a good bit now and have yet to
see filled="f" in any of the resulting HTML.

If you start with a blank presentation, add a single rectangle, what do you get?
If the filled=f appears, email me a copy at steve at-sign pptools dot com
[1] Example of an exported transparent shape:

<v:shape
id="_x0000_s24618"
type="#_x0000_t202"
style='position:absolute; left:168pt; top:258pt; width:468pt;
height:84.25pt'
filled="f"
fillcolor="#0c9 [4]"
stroked="f"
strokecolor="black [1]">
</v:shape>
 
D

Daniel Kirsch

Steve said:
If you start with a blank presentation, add a single rectangle, what do you get?

The rectangle gets the default fill color. No filled="f" attribute.

If the filled=f appears, email me a copy at steve at-sign pptools dot com

It appears for a second rectangle where I changed the fillcolor to "no
filling".

The simple one slide test including the webexport can be found here:
www.birgin.de/test/ida/pp_test.zip

I'm currently using Powerpoint 2003.

Daniel
 
S

Steve Rindsberg

The rectangle gets the default fill color. No filled="f" attribute.


It appears for a second rectangle where I changed the fillcolor to "no
filling".

The simple one slide test including the webexport can be found here:
www.birgin.de/test/ida/pp_test.zip

Thanks ... got it.

The filled="f" attribute appears when you choose No Fill for the shape.

PPT retains the fill color et al, but doesn't actually use it.
If you change the "f" to "t", the shape fills again.
 
D

Daniel Kirsch

Steve said:
The filled="f" attribute appears when you choose No Fill for the shape.

PPT retains the fill color et al, but doesn't actually use it.
If you change the "f" to "t", the shape fills again.

I found all that, but how do I get that info from a Shape or Shape.Fill
object not the allready exported HTML?

I use an activeX instance, open the ppt file, and check a shape on a
specified slide. However I cannot find the property that tells me that
"No Fill" is chosen.

Steve, thanks a lot for your patience. :)

Daniel
 
D

Daniel Kirsch

Daniel said:
I found all that, but how do I get that info from a Shape or Shape.Fill
object not the allready exported HTML?

Fill.Visible

Oh how simple is that!

Steve, your macro hint saved me another day. Thanks a lot.

Daniel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top