2:17 am

85 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:ln w="12700" cmpd="sng">
            <a:schemeClr val="lt1"/>

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

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

      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: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:tcTxStyle >
    <a:fontRef idx="minor" >
    <a:prstClr val="black" />
    </a:fontRef >
    <a:schemeClr val="bg1" />
    </a:tcTxStyle >
    <a:tcBdr />
    <a:fill >
    <a:solidFill >
    <a:schemeClr val="accent1" />
    </a:solidFill >
    </a:fill >

    • 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:spcPct val="130000"/>
          <a:spcPts val="1200"/>
          <a:spcPts val="500"/>
          <a:tab pos="457200" algn="l"/>
          <a:tab pos="914400" algn="l"/>
          <a:tab pos="1371600" algn="l"/>

      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:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/table">
            <a:tblPr firstRow="1" lastRow="1">
  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:fontRef idx="minor">
      <a:prstClr val="black"/>
      <a:srgbClr val="FF"/>
      <a:schemeClr val="accent3"/>

      • 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">

      • 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.


    • 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?


    • 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 🙂
        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 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:ln w="0" cmpd="sng">

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

          <a:fontRef idx="minor">
            <a:prstClr val="black"/>
          <a:schemeClr val="lt1"/>
              <a:ln w="0" cmpd="sng">
              <a:schemeClr val="dk2"/>

      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.


    • 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,

  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:schemeClr val="dk2"/">"

    Thank you in advance!

  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.


  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

    • 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.

  28. Hey John, I came across a weird behaviour of custom tables when exporting slides as images.
    We have defined 3 custom styles that fully work. When using a VBA function like <b&gtCurrentSlide.Export "path/image.jpg", "JPG", 3072<b&gt on a slide with one of our custom tables, the table on the exported picture loses all style information and gets replaced with the default standard table.
    I tried it with some of the stock PPT tables and they all retain their visual appearance.
    Have you experienced this behaviour before? Do you have any explanation?

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.