Hi..
I'm trying to add the ability in my code to set the background colour of the cell. This should be done similar to the font colours, by adding a solidFill etc, so I wrote:
def set_cell_background_color(cell, rgbColor):
print "cell %r" % cell
print "color %s" % rgbColor
tc = cell._Cell__tc
solidFill = _SubElement(tc, 'a:solidFill')
srgbClr = _SubElement(solidFill, 'a:srgbClr')
srgbClr.set('val', rgbColor)
Which I guessed as being correct after looking in shapes.py at _Cell, and seeing where it put the marL etc attributes. This ends up creating an empty tcPr element, followed by the solidFill, which Powerpoint doesn't like.
It seems that _Cell does, somehow/somewhere, create an empty tcPr element, but I can't see how to add my solidFill to it. If I change my code to:
def set_cell_background_color(cell, rgbColor):
print "cell %r" % cell
print "color %s" % rgbColor
tc = cell._Cell__tc
solidFill = _SubElement(tc, 'a:solidFill')
srgbClr = _SubElement(solidFill, 'a:srgbClr')
srgbClr.set('val', rgbColor)
Then I get TWO tcPr elements, which isn't allowed.
Any ideas?
(Issue completely rewritten as I was being a nitwit..)
From the relaxng spec:
a_CT_TableCell =
default value: 1
attribute rowSpan { xsd:int }?,
default value: 1
attribute gridSpan { xsd:int }?,
default value: false
attribute hMerge { xsd:boolean }?,
default value: false
attribute vMerge { xsd:boolean }?,
attribute id { xsd:string }?,
element txBody { a_CT_TextBody }?,
element tcPr { a_CT_TableCellProperties }?,
element extLst { a_CT_OfficeArtExtensionList }?
a_CT_TableCellProperties =
default value: 91440
attribute marL { a_ST_Coordinate32 }?,
default value: 91440
attribute marR { a_ST_Coordinate32 }?,
default value: 45720
attribute marT { a_ST_Coordinate32 }?,
default value: 45720
attribute marB { a_ST_Coordinate32 }?,
default value: horz
attribute vert { a_ST_TextVerticalType }?,
default value: t
attribute anchor { a_ST_TextAnchoringType }?,
default value: false
attribute anchorCtr { xsd:boolean }?,
default value: clip
attribute horzOverflow { a_ST_TextHorzOverflowType }?,
element lnL { a_CT_LineProperties }?,
element lnR { a_CT_LineProperties }?,
element lnT { a_CT_LineProperties }?,
element lnB { a_CT_LineProperties }?,
element lnTlToBr { a_CT_LineProperties }?,
element lnBlToTr { a_CT_LineProperties }?,
element cell3D { a_CT_Cell3D }?,
a_EG_FillProperties?,
element headers { a_CT_Headers }?,
element extLst { a_CT_OfficeArtExtensionList }?