OOXML Hacking: Custom Table Styles

For branded documents, you want to have a unique table style. Microsoft Office programs include a pile of table styles that are auto-created by the software, but they all have that generic MS look. It's possible to create custom styles in Excel and Word for both Windows and Mac using the program interface. But if you're using PowerPopint, you can still create custom table styles. You just have to hack some XML!

First we have to cover how Office programs create custom tables. It's not a simple subject, but understanding this will also help you if you're trying to create custom table styles in Word for Windows or Excel, which actually have tools to do this in the respective programs.

Let's start by making one thing clear: table styles do not format the font choice or size contained in the tables. Yes, I know the Word and Excel table style tools have font formatting dropdowns, yes I know Microsoft help files say that font styling is included in table styles. The truth is that font styling in a table style is limited to setting bold or italic attributes, font color and whether the table component uses the Headings or Body font as specced in the Font Theme. For typeface and size, alignment and weight/italic controls, read my post on Default Table Text

I find that it's easier to format Office tables if I imagine that table formatting has layers. The base layer is any overall formatting that applies to the table as a whole. Then, we build layers on top of that base formatting that looks after the Header Row, probably the most common feature applied to tables. We follow this with the Total Row, the bottom one. Next, the First and Last Columns. Once these outer areas are formatted, we add layers for Even and Odd Row Banding and then Even and Odd Column Banding. Finally, we can spec special formatting for the cells in the 4 corners. This sequence moves from the general to the particular and also from the most common to the rarest formatting.

This sequence is how the table style dialogs in Word for Windows and Excel present table elements. It's similar to the order in which we enter the information in an XML custom table style. If you follow this order, you'll get a custom style in much less time than if, for instance, you try to start with the even and odd rows.

Word's custom table styles are stored in the styles.xml file. This is in the word folder of an unzipped file. The comparable file for PowerPoint is called tableStyles.xml in the ppt folder. The XML is similar in concept, but the differences mean you can't copy and paste from one program to another. If you're not sure where to find these files, please read XML Hacking:An Introduction. If you're editing on a Mac, you should also read XML Hacking: Editing in OS X

Below is a typical PowerPoint table style. I've broken the listing into 4 pieces so it fits on the page. Copy and paste them together into one listing, or download it as a zipped text file:

Custom Table Style - Starter File

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<a:tblStyle styleId="{0817EA92-75D0-4044-A80A-286907CE0DDB}" styleName="Custom Table Style" >
  <a:wholeTbl >
    <a:tcTxStyle >
      <a:fontRef idx="minor" >
        <a:prstClr val="black"/ >
      </a:fontRef >
      <a:schemeClr val="dk1"/ >
    </a:tcTxStyle >
    <a:tcStyle >
      <a:tcBdr >
        <a:left >
          <a:ln w="0" cmpd="sng" >
            <a:solidFill >
              <a:schemeClr val="bg1"/ >
            </a:solidFill >
          </a:ln >
        </a:left >
        <a:right >
          <a:ln w="0" cmpd="sng" >
            <a:solidFill >
              <a:schemeClr val="bg1"/ >
            </a:solidFill >
          </a:ln >
        </a:right >
        <a:top >
          <a:ln w="0" cmpd="sng" >
            <a:solidFill >
              <a:schemeClr val="bg1"/ >
            </a:solidFill >
          </a:ln >
        </a:top >
        <a:bottom >
          <a:ln w="0" cmpd="sng" >
            <a:solidFill >
              <a:schemeClr val="bg1"/ >
            </a:solidFill >
          </a:ln >
        </a:bottom >
        <a:insideH >
          <a:ln w="114300" cmpd="sng" >
            <a:solidFill >
              <a:schemeClr val="bg1"/ >
            </a:solidFill >
          </a:ln >
        </a:insideH >
        <a:insideV >
          <a:ln w="114300" cmpd="sng" >
            <a:solidFill >
              <a:schemeClr val="bg1"/ >
            </a:solidFill >
          </a:ln >
        </a:insideV >
      </a:tcBdr >
      <a:fill >
        <a:solidFill >
          <a:srgbClr val="F5F9FD"/ >
        </a:solidFill >
      </a:fill >
    </a:tcStyle >
  </a:wholeTbl >
  <a:band1H >
    <a:tcStyle >
      <a:tcBdr/ >
      <a:fill >
        <a:solidFill >
          <a:schemeClr val="accent6"/ >
        </a:solidFill >
      </a:fill >
    </a:tcStyle >
  </a:band1H >
  <a:band2H >
    <a:tcStyle >
      <a:tcBdr/ >
    </a:tcStyle >
  </a:band2H >
  <a:band1V >
    <a:tcStyle >
      <a:tcBdr/ >
      <a:fill >
        <a:solidFill >
          <a:srgbClr val="F5F9FD"/ >
        </a:solidFill >
      </a:fill >
    </a:tcStyle >
  </a:band1V >
  <a:band2V >
    <a:tcStyle >
      <a:tcBdr/ >
    </a:tcStyle >
  </a:band2V >
  <a:lastCol >
    <a:tcTxStyle >
      <a:fontRef idx="minor" >
        <a:prstClr val="black"/ >
      </a:fontRef >
      <a:schemeClr val="lt1"/ >
    </a:tcTxStyle >
    <a:tcStyle >
      <a:tcBdr/ >
      <a:fill >
        <a:solidFill >
          <a:srgbClr val="999999"/ >
        </a:solidFill >
      </a:fill >
    </a:tcStyle >
  </a:lastCol >
  <a:firstCol >
    <a:tcTxStyle >
      <a:fontRef idx="minor" >
        <a:prstClr val="black"/ >
      </a:fontRef >
      <a:schemeClr val="dk2"/ >
    </a:tcTxStyle >
    <a:tcStyle >
      <a:tcBdr/ >
      <a:fill >
        <a:solidFill >
          <a:srgbClr val="F3F3F4"/ >
        </a:solidFill >
      </a:fill >
    </a:tcStyle >
  </a:firstCol >
  <a:lastRow >
    <a:tcTxStyle >
      <a:fontRef idx="minor" >
        <a:prstClr val="black"/ >
      </a:fontRef >
      <a:schemeClr val="dk1"/ >
    </a:tcTxStyle >
    <a:tcStyle >
      <a:tcBdr >
        <a:top >
          <a:ln w="114300" cmpd="sng" >
            <a:solidFill >
              <a:schemeClr val="lt1"/ >
            </a:solidFill >
          </a:ln >
        </a:top >
      </a:tcBdr >
      <a:fill >
        <a:solidFill >
          <a:srgbClr val="CCCCCC"/ >
        </a:solidFill >
      </a:fill >
    </a:tcStyle >
  </a:lastRow >
  <a:firstRow >
    <a:tcTxStyle >
      <a:fontRef idx="minor" >
        <a:prstClr val="black"/ >
      </a:fontRef >
      <a:schemeClr val="lt1"/ >
    </a:tcTxStyle >
    <a:tcStyle >
      <a:tcBdr >
        <a:bottom >
          <a:ln w="114300" cmpd="sng" >
            <a:solidFill >
              <a:schemeClr val="lt1"/ >
            </a:solidFill >
          </a:ln >
        </a:bottom >
      </a:tcBdr >
      <a:fill >
        <a:solidFill >
          <a:schemeClr val="dk2"/ >
        </a:solidFill >
      </a:fill >
    </a:tcStyle >
  </a:firstRow >
</a:tblStyle >

Breaking Down Custom Table Styles

That's a big pile of XML to throw at you. Let's break it down, first, the section that sets parameters for the whole table. Think of this like a layer cake, with the WholeTbl section being the first layer. Then later attributes are superimposed on top of it.

01 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
02 <a:tblStyle styleId="{0817EA92-75D0-4044-A80A-286907CE0DDB}" styleName="Custom Table Style" >
03   <a:wholeTbl >
04     <a:tcTxStyle >
05       <a:fontRef idx="minor" >
06         <a:prstClr val="black"/ >
07       </a:fontRef >
08       <a:schemeClr val="dk1"/ >
09     </a:tcTxStyle >

From line 3 to 8, we set the font characteristics that we can: idx="minor" means the font will be the theme body font. The actual font used is set in the theme, not here. Line 5 sets a dummy font color, in this case the Office preset color Black. Then in line 8, the actual color is set to the dark1 theme color.

10     <a:tcStyle >
11       <a:tcBdr >
12         <a:left >
13           <a:ln w="0" cmpd="sng" >
14             <a:solidFill >
15               <a:schemeClr val="bg1"/ >
16             </a:solidFill >
17           </a:ln >
18         </a:left >

Line 10 begins formatting the default borders. Beginning at line 12, the left border is set to w=0, meaning it has a 0 thickness and does not display. If it did display, the color setting in line 14 would set it to bg1, or the first background color, normally white in most themes. The following sections for right, top and bottom borders are identical.

40         <a:insideH >
41           <a:ln w="114300" cmpd="sng" >
42             <a:solidFill >
43               <a:schemeClr val="bg1"/ >
44             </a:solidFill >
45           </a:ln >
46         </a:insideH >

By contrast, look at line 40 for Inside Horizontal borders (the ones between each cell. Here the weight is set w=114300. The measurement units are EMUs or English Metric Unit, a made-up measurement system that allows easy conversion between English and Metric systems. At 914400 EMUs per inch, it means the line weight is 1/8 of an inch, unusually thick borders for a table.

55       <a:fill >
56         <a:solidFill >
57           <a:srgbClr val="F5F9FD"/ >
58         </a:solidFill >
59       </a:fill >
60     </a:tcStyle >
61   </a:wholeTbl >

Then, starting on line 55, are the fill settings for default cells. Line 57 set them to an RGB color value, since this is a tint not found in the theme. The color notation is hexadecimal, just as on an HTML page.

Custom Table Style Layers

Next up is the section for the odd and even-numbered horizontal bands:

62   <a:band1H >
63     <a:tcStyle >
64       <a:tcBdr/ >
65       <a:fill >
66         <a:solidFill >
67           <a:schemeClr val="accent6"/ >
68         </a:solidFill >
69       </a:fill >
70     </a:tcStyle >
71   </a:band1H >
72   <a:band2H >
73     <a:tcStyle >
74       <a:tcBdr/ >
75     </a:tcStyle >
76   </a:band2H >

In XML, an empty or unused attribute closes itself, as does the final object in a chain of references. Line 64 shows <a:tcBdr/ > with a slash right after the name. The slash closes the border attribute, indicating that adding odd-number row formatting doesn't include a change to the borders. On the other hand, the fill is active, using the Accent 6 color from the theme. Accent 6 closes itself because it's the final item of information in defining the fill.

Compare lines 72 to 76 (even-numbered rows) with 63 to 71 (odd-numbered rows). No format was set for even-numbered horizontal rows, so applying this attribute in Office will have no effect on the table appearance.

Next up are banded columns. This is similar to the banded row section: odd-numbered rows are defined, but not even-numbered. The fill color is a hexadecimal RGB, value, since this color is not in the theme:

77   <a:band1V >
78     <a:tcStyle >
79       <a:tcBdr/ >
80       <a:fill >
81         <a:solidFill >
82           <a:srgbClr val="F5F9FD"/ >
83         </a:solidFill >
84       </a:fill >
85     </a:tcStyle >
86   </a:band1V >
97   <a:band2V >
98     <a:tcStyle >
99       <a:tcBdr/ >
100     </a:tcStyle >
101   </a:band2V >

After banded rows and columns, we proceed to first/last rows and columns, more layers in the cake. Here's the XML for the Last (rightmost) Column:

102   <a:lastCol >
103     <a:tcTxStyle >
104       <a:fontRef idx="minor" >
105         <a:prstClr val="black"/ >
106       </a:fontRef >
107       <a:schemeClr val="lt1"/ >
108     </a:tcTxStyle >
109     <a:tcStyle >
110       <a:tcBdr/ >
111       <a:fill >
112         <a:solidFill >
113           <a:srgbClr val="999999"/ >
114         </a:solidFill >
115       </a:fill >
116     </a:tcStyle >
117   </a:lastCol >

This contains sections for font, border and fill parameters. As with the whole table section, font formatting is limited to speccing which theme font and color to use. No borders are assigned and the fill color is an RGB gray. Here are the remaining parameters for the First (leftmost) Column, the the last (bottom) row and first (top) row. In the Office interface, the top-most row is referred to as the Header Row and the bottom-most as the Total Row.

Custom Table Styles - Color Models

Here are the different ways you can spec color. Use the same syntax for fonts, borders and fills:

<a:schemeClr>: These access the Theme Colors. For the 2 pairs of light and dark colors that form the first 4 in a theme, you may see them variously as lt1, dk1, lt2 and dk2, or bg1, tx1, bg2 and tx2. Be careful with using the last 4, because Office Open XML allows mapping other colors to bg and tx. The safer choices are lt and dk. These are followed by the 6 accent colors: accent1 through accent6. Finally hlink and folHlink designate the hyperlink and followed hyperlink colors.
Examples are <a:schemeClr val="lt1"/> or <a:schemeClr val="accent2"/>.

<a:srgbClr>: Sometimes you need colors that are not in the theme. This color model uses hexadecimal colors, exactly the same as used in HTML.
<a:srgbClr val="F5F9FD"/> is one example.

<a:scrgbClr>: This is also RGB, but uses percentages instead of hexadecimal:
<a:scrgbClr r="50%" g="50%" b="50%"/>.

<a:hslClr>: If you need to use HSL (Hue, Saturation and Luminance), this is the model for you.
Try <a:hslClr hue="14400000" sat="100%" lum="50%"/>.

<a:prstClr>: These are a limited range of named colors that were used in early versions of Microsoft Office. They're just here for legacy file format support, but you'll see them used in some XML sample listings.
An example would be <a:prstClr val="black"/>.

<a:sysClr>: This model allows you to use operating system colors. Beware, you'll get different results in OS X then in Windows, and users can customize their system colors as well.
<a:sysClr val="windowText"/>.

Clearly, when you edit this XML by hand, you'll need to be familiar with the custom color theme used in the file and its hex values. Read my post on this subject: XML Hacking: Color Themes Next time we'll take a look at how table styles connect with the Office program interface to give the user access to these features

As always, if this seems too daunting, Brandwares is here to create custom table styles for you. Contact me at production@brandwares.com

2:17 am

81 thoughts on “OOXML Hacking: Custom Table Styles

  1. Thank you for the helpful article. Is it possible to create a table style in Word and then apply the XML file in PowerPoint?

    • Unfortunately, the XML syntax for table styles is quite different. As one example, PowerPoint uses an a: prefix while Word uses w: at the start of every line. In addition, Word stores the table styles with all the text styles in styles.xml. PowerPoint doesn't have text styles, so its table style file is called tableStyles.xml

    • I have been taught that when you area creating custom document "Themes" for corporate use that are going to be shared between the 3 applications, Word Excel and PowerPoint, you MUST start the creation process in PowerPoint. Apparently PPT has a unique few theme elements. If they are not included in the theme XML file at create they will NOT be added later.

      I don't know if this applies to trying to share XML Table formatting.

      • It's not absolutely necessary to create a Theme in PowerPoint. But if you save one in Word or Excel, the Theme will contain only the Color, Font and Effect themes, so the information is quite basic. If you save a theme from PowerPoint, it will save all the presentation custom formatting, so you can create a complete PowerPoint presentation from it.

        Unfortunately, Excel and Word use different XML for tables, so the PowerPoint custom table style is not usable in the other programs.

  2. Hi John,
    You say "Here’s a typical table style" but don't say how to get this XML file. I'm assuming that these reside somewhere in the Office installation or can be extracted from files therein? Could you elaborate?
    Thanks, Chris

  3. Is it possible to program different second (subheading row) in the styles.xml file, and is it true that if a table is styled in Word and copy pasted in PowerPoint XML with syntax fixes it will do the job?

    • A subheading row would be a useful addition to Microsoft's table model, but there's nothing in the current version to format one.

      While the basic structures of tables are similar in Word and PowerPoint, it looks like the XML was developed by separate teams. There are so many small differences, and Office is so intolerant of even slightly malformed XML, I can't see any way it would save any time to modify and paste the tables.

  4. I'm trying to edit the table styles in a .potx right now. Does this only work in .ppt or .pptx? When I make the changes in the XML for my .potx and then go reopen the file, nothing seems to have changed.

    • This technique wouldn't work for a PPT file, which is the old binary format for Office 2003 and earlier. But it does work for POTX and PPTX.

      When you first add a custom table style, the presentation itself doesn't change. But when you click on the Table Style Gallery, you'll see a new row labelled Custom at the top. That row will contain your new table style. Select a table, then apply the style to it. Now if you save the template file to a new folder, expand the XML and edit the table style, the table style changes will be visible in your sample table after you re-zip the file and look at it in PowerPoint.

  5. Thank you for the thorough information in this set of tutorials. I wanted to try creating a customized table in Powerpoint, but first tried just using the code you provided above. I am having an issue getting the code to work in the "tableStyles.xml" file. When I try to open the resulting .pptx file after changing the file, Powerpoint says there is an error and cannot repair the file. In the end I cannot see the custom table available in the ribbon. I also noticed when I copied the text over in Notepad++ I received an error: "XML Parsing error at line 167: Couldn't find end of Start Tag schemeClr line 166" I wonder if this is the problem, but am not sure how to fix it. I tried this is multiple .pptx files, including a brand new blank set of slides. Thanks for any advice.

    • This is one of the pitfalls of hacking Open Office XML. Office has no debugging facility for this. Even a tiny spelling or syntax error will cause PowerPoint to throw out the custom coding without telling you what the problem was.

      The NotePad++ error sounds like it might be pointing in a useful direction. Opening XML files in Firefox can also be useful for tracking down mistakes. All XML statements have both an opening and closing. If the statement contains other XML statements, the opening will look like this:

      <a:solidFill>  Opening tag for fill statement
        <Another XML statement>
      </a:solidFill>Closing tag for fill statement

      If the XML statement has only one line, it must end with />. The slash acts as a closing tag for the statement, like this:

        <a:schemeClr val="bg1"/>

      When you're getting started, you may find it easier to work this way:

      1. Insert a table in your template or presentation and give it one of the stock styles.
      2. Expand the XML and find the table style in ppt/tableStyles.xml.
      3. Rename the style and give it a different GUID.
      4. Zip the XML and test it in PowerPoint.
      5. Unzip the working presentation to a new set of XML files.
      6. Make one change at a time and between each, zip the files and test them. Stop when you get an error and return to the last version that worked and try again.

      While this process is tedious, it's much faster than making multiple changes, then searching for tiny errors in a non-functional file.

  6. All of this was a very helpful, thank you. Now that I have gotten started, I am trying to dive into something more advanced. Specifically, trying to add borders that are dashed rather than solid. I have tried to find some of the syntax I need, but I am having a lot of trouble. Do you know where there is a list of the syntax I need, or can you provide that syntax?

    • Borders for table styles use the a:ln element. You can find the parameters for this by Googling a:ln ooxml. Both solid and dashed borders use a:ln, but dashed borders add some parameters. The Datypic.com site has a basic listing of line settings. The Office Open XML site has a more verbose description of borders.

      A solid line spec will look like this:

      <a:insideV>
        <a:ln w="12700" cmpd="sng">
          <a:solidFill>
            <a:schemeClr val="lt1"/>
          </a:solidFill>
        </a:ln>
      </a:insideV>

      A dashed border is similar, but with more parameters. The new ones are bolded:

      <a:insideV>
        <a:ln w="12700" cmpd="sng" cap="flat" algn="ctr">
          <a:solidFill>
            <a:schemeClr val="lt1"/>
          </a:solidFill>
          <a:prstDash val="sysDash"/>
          <a:round/>
          <a:headEnd type="none" w="med" len="med"/>
          <a:tailEnd type="none" w="med" len="med"/>
        </a:ln>
      </a:insideV>

      The purpose of these is as follows:

      cap="flat" - sets the shape of the dash ends.

      algn="ctr" - sets lateral position of the line relative to its center.

      a:prstDash val="sysDash" - sets the dash style. These are the same as the selection of dashed line styles you see in a border dropdown.

      a:round - sets the corner join shape where 2 lines meet.

      a:headEnd type="none" w="med" len="med" and a:tailEnd type="none" w="med" len="med" - sets the shape of the end of the line. You would use this to add an arrowhead or other shape, not relevant in the context of a table.

      This is a very basic overview to get you started. Eventually I'll write this up into a full article.

  7. With the following table style only firstRow is showing up, firstCol is not. What could be wrong?

    <a:firstCol>
    <a:tcTxStyle >
    <a:fontRef idx="minor" >
    <a:prstClr val="black" />
    </a:fontRef >
    <a:schemeClr val="bg1" />
    </a:tcTxStyle >
    <a:tcStyle >
    <a:tcBdr />
    <a:fill >
    <a:solidFill >
    <a:schemeClr val="accent1" />
    </a:solidFill >
    </a:fill >
    </a:tcStyle >
    </a:firstCol>
    <a:firstRow>
    <a:tcTxStyle >
    <a:fontRef idx="minor" >
    <a:prstClr val="black" />
    </a:fontRef >
    <a:schemeClr val="bg1" />
    </a:tcTxStyle >
    <a:tcStyle>
    <a:tcBdr />
    <a:fill >
    <a:solidFill >
    <a:schemeClr val="accent1" />
    </a:solidFill >
    </a:fill >
    </a:tcStyle>
    </a:firstRow>

    • Since this is only part of the table style, it's hard to tell what the problem might be. Feel free to send me the PowerPoint file with the table style. My address is production at brandwares dot com.

  8. Compliment for this great tutorial, Mr. Korchok. It helps me a lot. Now, I'm looking for the TableRowHeight Class in OOXML. Where can I define it into the the table style parameters? Thank you for your help.

    • Table Styles don't include all table parameters. Row heights, column widths and cell margins are among these. You'll have to include a sample with an explanation, so users can re-create the right look, or you'll have to write a macro to post-process the table and set your preferred dimensions.

      • Thank you for your answer. Well, it works now by VBA makro, but I'm not very happy with it. Isn't it strange that Microsoft does not provide a solution for it in Open XML? }:-7

  9. I am just editing the tablestyles.xml and slidemaster.xml for a new Powerpont-Presentation and I want to change the default linespacing from "Single" to "Multiple at 1.3". Is this adjustment possible or not part of the table style parameters? Thank you for your help.

    • You can set linespacing in slidemaster1.xml in the otherStyle section. Here's a sample of xml that shows settings for linespacing set to Multiple at 1.3, space before, space after and default tabs:

      <a:lvl2pPr marL="0" indent="0">
        <a:lnSpc>
          <a:spcPct val="130000"/>
        </a:lnSpc>
        <a:spcBef>
          <a:spcPts val="1200"/>
        </a:spcBef>
        <a:spcAft>
          <a:spcPts val="500"/>
        </a:spcAft>
        <a:tabLst>
          <a:tab pos="457200" algn="l"/>
          <a:tab pos="914400" algn="l"/>
          <a:tab pos="1371600" algn="l"/>
        </a:tabLst>

      For complete coverage of all parameters you can set in the otherStyle section, please read my articles about setting Textbox Styles: XML Hacking: Text Box Styles and XML Hacking: Styled Text Boxes Complete. The syntax is exactly the same.

  10. thank you so much for this great resource. I am now trying to modify a style in Word after having used this page extensively for PPT. Do you have a Word table example page or no because Word has some (limited) built in ability to create custom tables?

    • Word and Excel can create fairly complete custom table styles with the tools in the interface, but the process is far from intuitive. Thanks for writing, you've given me the subject for my next post!

      • i'll be sure to look for it. also, do you have anywhere where you review how bullets/numbered lists work in Word? I find that after I make a multi level style, I cannot edit its sub layers once I have hit "Ok" on the style. after that, all i can do is edit the top most level. furthermore, it then creates a paragraph style which is not the same name as the name i assign it. I don't understand Word's internal logic for how the two are connected and why the naming difference. I am sepculating that if I even need to re-edit the bullet list, I have to go into the XML but i am completely lost when looking for it.

        • I agree, the logic behind numbered or bulleted styles is hard to understand. Shauna Kelly's article shows a reliable technique How to create numbered headings or outline numbering for Windows. For a Mac translation, please see my article Outline Numbering in Word for OS X. These articles assume you are applying numbering to the built-in heading styles, but you can apply numbering to any set of styles by using the instructions in Outline Numbering Variations.

          You can create nested sets of bullet styles by following the same steps. When the Define new Multilevel list dialog is open, use the dropdown called Number style for this level, scroll all the way down and you'll find 6 bullet presets and options for choosing a different bullet or a picture bullet. I'll add this information to the article about Outline Numbering Variations.

  11. Thank you so incredibly much for creating this. You rock!

    I followed your instructions and was able to create a new Custom Style in ppt with the last row in bold. However, the bold only shows up when I have Total Row checked.







    Is there anyway to get the bold to always appear? Or even set the Total Row button to be automatically checked?

    I am also looking to modify the text alignment depending on the column (i.e. first column would be left aligned, all others would be right aligned). From your Default Table Text article, it doesn't seem like this is possible. Could you confirm?

    Appreciate your guidance! And again, thank you for guiding us!

    • To get your XML code to appear in your post, please follow the instructions just above the Comment box for substituting the < and > signs.

      PowerPoint's default settings check only the Header Row and Banding options. I don't see way to set different defaults (they appear to be hard-coded in the program), and they is no place to set the Table Style Options in the table style XML. I'm afraid you'll have to continue checking the Table Style Option after every table insertion.

      Below is the XML that includes the table style options with Total Row turned on. This appears in the slide XML only after inserting a table.

      <a:graphic>
        <a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/table">
          <a:tbl>
            <a:tblPr firstRow="1" lastRow="1">
              <a:tableStyleId>{0817EA92-75D0-4044-A80A-286907CE0DDB}</a:tableStyleId>
            </a:tblPr>
  12. Hi,
    The article is great!!! I was wondering if it is possible to set the custom table style as the default in Powerpoint. So every time the user creates a new table then this table will get the custom table design i created automatically

    • In Windows versions of PowerPoint, create a table so that the Table Styles gallery opens. Click on the gallery opener on the right side, then right-click on your custom style and choose Set as Default. Then every new table that is inserted will be in the custom style.

      Mac versions don't have the same feature in the program interface. Instead, when you are editing the XML of tableStyles.xml, edit the second line, changing the def parameter to be the GUID of your custom table style. So if the GUID of your custom style is {0817EA92-75D0-4044-A80A-286907CE0DDB}, edit the second line to read <a:tblStyleLst xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" def="{0817EA92-75D0-4044-A80A-286907CE0DDB}">. This sets the default.

  13. Hi,
    I am trying to use so other content of a:tblStyle, such as seCell,neCell etc. I added it at the end of the schema but didn't work. Is it possible to use these here? The purpose is to create a special colored cell top left and bottom right if user has a total last row

    • It seems to work only for the nwcell (topleft) when first column is clicked in Table Style Options.
      I used the code below and copy-paste it to create the different nodes
      <a:nwCell>
      <a:tcTxStyle>
      <a:fontRef idx="minor">
      <a:prstClr val="black"/>
      </a:fontRef>
      <a:srgbClr val="FF"/>
      </a:tcTxStyle>
      <a:tcStyle>
      <a:fill>
      <a:solidFill>
      <a:schemeClr val="accent3"/>
      </a:solidFill>
      </a:fill>
      </a:tcStyle>
      </a:nwCell>

      • Sorry for my delayed response, I had to do a little research. Corner cell styling only get turned on if both the row and column options that intersect it are turned on. So if Header Row and First Column are checked, the upper left (NW) corner styling will appear. Total Row and First Column turns on the lower left (SE) corner, etc. There is no way to turn on the corner styling unless the intersecting row and column options are both checked by the user. I've never run across a method of presetting those options in a table style.

  14. I've just started doing XML hacking by following your posts here. They are so helpful. Thank you.

    My problem is that even though I've set all the borders to w="0" they are still appearing in the table. I can even change the a:solidFill to a different color and that color will appear so I know it's reading that code but I just can't get the borders to turn off completely. Can you help?

    • As you've discovered, setting the line width to 0 still displays a hairline. If you give the lines an a:noFill parameter, they will not show:

      <a:ln w="0" cmpd="sng">
        <a:noFill/>
      </a:ln>

      • What about Smart Art? Is there a way to hack the Smart Art gallery or formatting settings so you can change things like font color and border color?

          • Sorry to pester.

            Which xml file would hold the code for the Smart Art? I'd like to get in there and play around as soon as possible since I'm on a bit of a deadline.

      • I I left a comment a few days ago but it doesn't seem to have gone through.

        My question is whether it's possible to alter Smart Art settings (like text color, border color etc.) using XML hacking.

        • Oops. As soon as it published my most recent comment it showed me your reply! Sorry about that. 🙂 I would be very interested in that series of articles!

          • I don’t know where that file might have been. The book was written 11 years ago, before Office 2007 was actually released, so that file may never have been included in the final version.
            You can download a variety of sample .glox files from Loki3 Diagrams. That should get you started.

        • To alter an existing SmartArt diagram, unzip the file containing it, then look in word/diagrams (if it was created in Word) or ppt/diagrams for a PowerPoint diagram. There will be 5 XML files for each diagram. Here's a page from Microsoft that describes the function of each: SmartArt File Structure
          Creating a SmartArt template for distribution is a completely different and more complex operation that really needs full articles to explain it. In the meantime, here is the best reference available: Leveraging SmartArt Graphics

          • Thank you for that reference! I have purchased it and am following the steps. Only one thing, he mentions there being a Sample.glox somewhere on the machine but I can't find it. I'm assuming that was an older version of Windows? The link in this book to the page on his website with further information no longer works. Do you know where I could get a hold of a Sample.glox? I've done a bit of searching online but so far haven't turned up the file.

  15. Hi,

    I would like to know where is the folder location for the custom table style files.

    What is the exentions of theses files.

    Thanks
    Youness

    • Word’s custom table styles are stored in the styles.xml file. This is in the word folder of an unzipped file. The comparable file for PowerPoint is called tableStyles.xml in the ppt folder.

  16. Hi,
    Thanks for a great guide, this is really useful!
    I have one question though:
    Can you apply the add table to a .thmx file? I'd like the custom table styles to be there when I create a new file (using custom theme as default). Is this possible?

    Thanks,
    Simon

    • Unfortunately, custom table styles do not travel with a theme (*.thmx) file. Instead, save the file as a template (*.potx or *.potm) and create new presentations from that. You can set a template to be the default just as easily as setting a default theme. For reference, here is an article by Stephen Rindsberg with the steps for each version of PowerPoint.

      • You are an absolute star.
        The bit I'd missed is that if you have previously set a default theme you have to delete 'default theme.thmx', otherwise Blank.potx is ignored by PowerPoint.
        Deleting it allowed my potx to appear as the default and now my tables are as I would like them 🙂
        Thanks!
        Also, I have to say I'm impressed how promptly you answer comments on what is a relatively old page. Much appreciated!

  17. Hi. I always thanks to your kind information. It's really useful.
    I am trying to adapt the xml into my custom file, but it doesn't work.

    Below are the steps i did.

    1. Copy your xml
    2. Unzip Find ppt/tableStyles.xml and open it.
    3. Remove the original coding like below
    (
    )
    And paste your xml. Then, exchange the GUID to a new one.
    4. Rezip to pptx. (Just wanted to confirm that the custom table style was well-made)
    5. Open the pptx -> in this step i have an error! PowerPoints says that it'll try to repair.

    If i did a wrong step, please let me know.

    Sorry for my short tongue. RSVP

    • Oh I noticed I pasted wrong. Below may be the correct one.

      Below is the original xml code I can see.

      <?xml version="1.0" encoding="UTF-8" standalone="yes"? %gt;
      <a:tblStyleLst xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" def="{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}"/ %gt;

    • PowerPoint is not very helpful in their error messages, but it sounds like you accidentally entered some malformed XML. When PowerPoint offers to repair the presentation, it's because there is a relatively small error. This could be something a simple as smart quotes replacing straight quote, easy to get if you editing in TextEdit on the macOS.

      Feel free to email the XML or the whole presentation to me at production at brandwares dot com, and I'll take a look. If you do this, please include what operating system and version of Office you are using.

  18. Hi,

    thank you for all the tutorials, they are extremely helpful!

    I have two questions:

    1. Is there a way to remove or hide the automatically created design propositions for tables from the design tab? I found the checkbox for displaying only the custom ones, and suppose there has to be a place in xml to set it as a default option.

    2. I have created a couple of custom table styles in tableStyles.xml but failed to add outer shadow. My investigation led me to theme.xml files and effectStyleLst paragraph, but still I can't figure out how to use the defined outer shadow in tableStyles.xml.

    I'd really appreciate your help!
    Thanks,
    Wiolistka

    • Thanks for your kind words.

      The Microsoft table styles appear to be generated automatically by the program. I don't know of any way to remove them.

      After you create a custom table style, you can open the template in PowerPoint, insert a table, right-click on the new style and choose Set as Default. Then all tables will automatically have your styling when inserted. Then just tell your users not to apply any of the other styles.

      You are correct that shadows are part of an effects theme, not a table style. Effects themes are a fairly complex subject that would take numerous blog posts to explain. Instead I'm writing a book about XML that will cover all the details. I'll be announcing its publication here when it's ready.

  19. Hi,

    I'm updating a PPT we made a few years back with the help of your guide and want to remove some previous options. However, whenever I attempt to remove a style by deleting all its content (from the tblStyle tag to its corresponding close tag), I get an error upon copying it back into the PPT zip file. The zip file becomes unusable and must be deleted.

    What am I doing wrong in trying to remove one of the table styles?

    • I understand it's tempting to delete table styles you think are unused. However, most often PowerPoint knows when it needs to retain old formatting information. I never delete any old tableStyles, because they represent styles that have been applied, sometimes to objects you don't immediately recognize as a table. If any table uses a particular style and that style is deleted, it will generate an error.

      I recommend retaining all old table styles. Just add your new style. The savings in file size is insignificant.

  20. Any ideas on which XML fragment needs to be edited to set the vertical alignment of text within cells?
    I understand that size, etc is set within the lvl1pPR element and there is horizontal alignment set in that element but where do we set the vertical alignment of the text within those table cells? For instance a header row may be anchored at the bottom of a cell, but the main non-header content row text may be centered vertically within the content cells.

    • Sorry, but it's not possible to set vertical alignment in a table style. The XML vertical alignment parameters are for vertical alignment relative to the text baseline, not to the table cell.

      You also can't set cell margins or row heights or column widths, and spacing before and after paragraphs is ignored inside a table. Your ability to preset the final look of a table is limited.

  21. I am working in Windows 10 and need to set a default table font in a PowerPoint template, and I very much appreciate your instructions! I have downloaded Notepad++ and added .zip to my PPT filename, then opened the folder. I see your instructions on selecting 4 of the folders inside the zipped folder and creating a zipped file from them. I'm not sure how to perform this step. Do I need to extract these to a new folder location and then zip that folder by adding .zip to the folder name? Then once I work through the table style editing, change the folder extension to .pptx?

  22. If the whole table style sets a border, say the top border, can the First Row definition override this and turn it off? The following doesn't work for me:

    <a:top>
    <a:ln w="0" cmpd="sng">
    <a:noFill/>
    </a:ln>
    </a:top>

    • You snippet shows the correct syntax for overriding the parameters of the whole table. Here's a more complete first row definition:

      <a:firstRow>
        <a:tcTxStyle>
          <a:fontRef idx="minor">
            <a:prstClr val="black"/>
          </a:fontRef>
          <a:schemeClr val="lt1"/>
        </a:tcTxStyle>
        <a:tcStyle>
          <a:tcBdr>
            <a:top>
              <a:ln w="0" cmpd="sng">
                <a:noFill/>
              </a:ln>
            </a:top>
          </a:tcBdr>
          <a:fill>
            <a:solidFill>
              <a:schemeClr val="dk2"/>
            </a:solidFill>
          </a:fill>
        </a:tcStyle>
      </a:firstRow>

      If you can't get it figured out, feel free to email the complete table style definition to me and I'll take a look at it. production at brandwares dot com

  23. Awesome!

    Is there a way to show the vertical lines in front of the horizontal lines? To be exact: I want white vertical lines in front of black horizontal lines, so that you only see the interruption in the black horizontal lines. The background is also white.

    BR
    Donald

    • Good question, thanks. Normally in Office XML files, the order of XML elements is also the reverse stacking order of elements on the slide. So if the slide XML contains a Title placeholder, then a Content placeholder, on the slide the Content placeholder will be in front of the Title.

      In table styles, this doesn't hold true. We might expect that moving the <a:insideH> below the <a:insideV> section would put the horizontal lines above the vertical lines. But in table styles, there is a fixed order that PowerPoint expects. Not only do the horizontal lines not pop to the front, but when you save the file, the <a:insideH> section is deleted from the table style because it is out of order!

  24. Hi John -

    Thank you for another great post! This is something that I could definitely use on a project but I am having trouble finding the tablestyles.xml on my computer. I ran a search on the entire hard drive for this file and came up empty. Can you please provide the exact path this file would be under?

    I am on Mac OSX 10.12.6 and running PowerPoint 16.21.

    Also, if there is a custom table style that another PPT file came in with, is it possible to access that XML and build on top of it?

    Thank you in advance,
    Niyati

  25. Hi John -

    Thank you for this very helpful post! I had a question about color specifications. Is it necessary to specify a scheme color tag when defining a font style for the first row? Or is it enough to just specify the Hex value? I would like to keep only the Hex value in the event that the end user changes the order of the theme color. I don't want my table style to be impacted by this. Here is the code that I am using:

    "<"a:tcTxStyle b="on"">"
    "<"a:fontRef idx="minor"">"
    "<"a:srgbClr val="00CD82"/">"
    "<"/a:fontRef">"
    "<"a:schemeClr val="dk2"/">"
    "<"/a:tcTxStyle">"

    Thank you in advance!
    Niyati

  26. Please ignore the ""marks around the "<", ">" - I did a copy paste and didn't realize that the "" were not part of the character replacement.

    Thanks!

  27. John, these are great articles. Thank you for sharing your knowledge - it's really opened my eyes to what can be achieved.

    I have created a custom table style successfully but would like to create a second one in the same template to appear alongside the first one in the Custom table styles gallery. I'm assuming the styleId value for each custom style has to be unique, so where does that value come from for the second and subsequent table styles? For example:

    styleId="{59DA6C20-CC5B-45AE-9D43-645F2BD884D3}" styleName="Blue table"
    styleId="{?????}" styleName="Red table"

    Many thanks
    Richard

    • The Style ID is a GUID number (for Global Unique Identifier). They're random hexadecimal numbers. Search for GUID Generator to find web tools that will create these for you. It's best to always create new GUID numbers for every table style.

Leave a Reply

*Required fields. Your email address will not be published.

Posting XML? To enter XML code, please replace all less than signs "<" with "&lt;" and greater than signs ">" with "&gt;". Otherwise, Wordpress will strip them out and you will see only a blank area where your code would have appeared.