This is my first attempt with OpenXML and creating styles in code. I am trying to get the a style to do the following:
For a table,
1st row should be Bold, White, and background color of dark blue
all other rows should be (normal font), and a background color of white.
All rows should have a border on all four sides.
I've gotten the borders, and the conditional style for the 1st row, but I'm not seeing how to apply the background color to the rest of the document. And yea, I do want a white background because there is a picture behind the table that is not white.
Here is my code, what am I doing wrong?
Style style1 = new Style(
new TableProperties(
new TableCellProperties()
{
Shading = new Shading()
{
Val = ShadingPatternValues.Clear,
ThemeFill = ThemeColorValues.Background1,
Fill = "FFFFFF",
Color = "auto"
}
},
new TableBorders(
new TopBorder() { Val = BorderValues.Single },
new BottomBorder() { Val = BorderValues.Single },
new LeftBorder() { Val = BorderValues.Single },
new RightBorder() { Val = BorderValues.Single },
new InsideHorizontalBorder() { Val = BorderValues.Single },
new InsideVerticalBorder() { Val = BorderValues.Single })),
new TableStyleProperties(
new TableRowProperties(
new ParagraphProperties(
new RunProperties()
{
Bold = new Bold() { Val = true },
Color = new Color() { Val = "FFFFFF",
ThemeColor = ThemeColorValues.Background1 },
}),
new CantSplit(),
new TableHeader() { Val = OnOffOnlyValues.On },
new TableCellProperties()
{
Shading = new Shading()
{
Val = ShadingPatternValues.Clear,
ThemeFill = ThemeColorValues.Text2,
Fill = "1F497D",
Color = "auto"
}
}
)
) { Type = TableStyleOverrideValues.FirstRow }
)
{
Default = false,
Type = StyleValues.Table,
StyleId = "TableStyle1",
StyleName = new StyleName() { Val = "TableStyle1" },
UIPriority = new UIPriority() { Val = 1 }
};
jhoop