Share via


PowerPoint Table Styles XML (Part 1)

One of the coolest parts of the new tables feature in PowerPoint is that you can style tables. The design of the table styles feature mixes some of the flexibility of Word's table styles with the power of the new OfficeArt platform. Like Word, we have several parts to a table style, and these parts are applied in a very similar way. A part is defined as a group of cells which we will apply a style to in certain circumstances. There are 6 flags which determine when we apply parts to the given cells:

Flag Description
Header Row Applies styling to the top row. In conjunction with the First/Last Column options also applies corner styling.
Total Row Applies styling to the bottom row. In conjunction with the First/Last Column options also applies corner styling.
Banded Rows Applies 2 alternating styles to all rows between the top and bottom.
First Column Applies styling to the Left (Right in Right-To-Left languages) column. In conjunction with the Header/Total Row options also applies corner styling.
Last Column Applies styling to the Right (Left in Right-To-Left languages) column. In conjunction with the Header/Total Row options also applies corner styling.
Banded Columns Applies 2 alternating styles to all columns between the left and right.

A Table Style has a background style and 13 part styles. They are listed in the XML and applied in the order listed from back to front in the following table. Source: Office Open XML Draft Spec 1.4 - Markup Language Reference Section 5.1.5.9 - DrawingML Reference Material -> Tables -> tableStlye element on page 3135. Also found in the Table Styles section (5.1.3.2 on pages 2918-2951)

<complexType name="CT_TableStyle"> <sequence> <element name="tblBg" type="CT_TableBackgroundStyle" minOccurs="0" maxOccurs="1"/> <element name="wholeTbl" type="CT_TablePartStyle" minOccurs="0" maxOccurs="1"/> <element name="band1H" type="CT_TablePartStyle" minOccurs="0" maxOccurs="1"/> <element name="band2H" type="CT_TablePartStyle" minOccurs="0" maxOccurs="1"/> <element name="band1V" type="CT_TablePartStyle" minOccurs="0" maxOccurs="1"/> <element name="band2V" type="CT_TablePartStyle" minOccurs="0" maxOccurs="1"/> <element name="lastCol" type="CT_TablePartStyle" minOccurs="0" maxOccurs="1"/> <element name="firstCol" type="CT_TablePartStyle" minOccurs="0" maxOccurs="1"/> <element name="lastRow" type="CT_TablePartStyle" minOccurs="0" maxOccurs="1"/> <element name="seCell" type="CT_TablePartStyle" minOccurs="0" maxOccurs="1"/> <element name="swCell" type="CT_TablePartStyle" minOccurs="0" maxOccurs="1"/> <element name="firstRow" type="CT_TablePartStyle" minOccurs="0" maxOccurs="1"/> <element name="neCell" type="CT_TablePartStyle" minOccurs="0" maxOccurs="1"/> <element name="nwCell" type="CT_TablePartStyle" minOccurs="0" maxOccurs="1"/> <element name="extLst" type="CT_OfficeArtExtensionList" minOccurs="0" maxOccurs="1"/> </sequence> <attribute name="styleId" type="ST_Guid" use="required"/> <attribute name="styleName" type="xsd:string" use="required"/></complexType>

Note that because the list of table part styles is specified in a sequence, you must list the parts in the order specified above in order to make valid XML that Office can read. Having them appear in order from back to front helps designers to tell what part styles override what other part styles.

Another thing to note: in order to work correctly, you must generate GUIDs with actual GUID generating tools or an online GUID generator. GUIDs work best if they are unique. That should be enough information to wet your appetite. Next time, we'll go over some samples and show off the power of what you can do with them and the OfficeArt platform underneath.

This posting is provided "AS-IS" with no warranties and confers no rights.

Comments