Let’s start hacking some XML with a simple project: setting the default table text size. This article assumes you have read the introduction and have a suitable text editor installed. Mac users should also read XML Hacking: Editing in OS X.
When you insert a new table in PowerPoint, the default table text size is 18 points. Using XML hacking, we can set this to whatever point size the designer prefers. You can also set the text to appear in all caps. Following the previous post’s instructions, add .zip to the file ending and unzip the file. Look for the ppt folder and open it:
In the ppt folder is another folder called slideMasters. If your sample presentation is typical, it has only one Slide Master, so you won’t be surprised to find that typically slideMasters contains only one file, called slideMaster1.xml. Open this file in your text editor and reformat the XML to make it readable (XML Tools>Pretty Print in NotePad++, or Markup>Tidy>Reflow in BBEdit). Scroll down to near the end, looking for a tag called <p:otherStyle>. This is the section that formats default text in miscellaneous objects, like tables:
Default Table Text Levels
Within the otherStyle section, the 4th line starts with <a:lvl1pPr. Then the 14th line begins with <a:lvl2pPr. Each of these 10-line sections formats a different text level, with the 4th line starting the first and the 14th beginning the second level. A handy, if terse, reference to all the parameters is shown here. Not all of these are actually used in the context of a table. As one example, there are a:spcBef and a:spcAft for setting space before and after, but this is ignored by PowerPoint in a table. PowerPoint pays attention to the font size, the left margin, line spacing, alignment and whether it’s all-caps, small caps, bold and/or italic.
The font size is set by this line: <a:defRPr sz="1800" kern="1200">. sz=1800 is the font size in hundredths of a point, so 1800 gives us the default 18-point size. Since this is the first level that might well be used for table headings, you could set it to something like 1450 to get a 14.5 point result.
Since this first level can be used for headings, let’s make it all-caps while we’re at it. Edit the line to read <a:defRPr sz="1450" kern="1200" cap="all">. Done! (Please note, this can be used for headings, but the user must still use the Home>Increase List Level command to set the actual level of text for each section of the table. In PowerPoint 2016 for Mac, the command is called Indent More.)
Now proceed to the second level and set its point size. Something like <a:defRPr sz="1200" kern="1200">
Other useful attributes for <a:defRPr> include cap="small" for small caps, b="1" for bold and i="1" for italics. In addition, spc="400" adds enough tracking to make 10pt text have about 1 character width between each pair. This latter parameter can be positive for wider spacing or negative to crunch text together.
Scroll down a little further: you’ll notice that there are 9 levels, though in a table you’ll probably only use the first 2 or 3. In typical Microsoft style, each level is indented further than the preceding one. Compare level 1 with level 2:
marL is the left margin. The units of measurement here are EMUs: English Metric Units. This is an invented measurement system that allows easy conversion between English and Metric. suffice it to say that 457200 EMUs is 1/2". When I modify this section, I set all 9 levels to marL="0". I also set all lower levels to the same point size as the lowest designed level, level 2 in our example. That way, if a user keeps changing to a lower text level, the formatting remains the same.
Text alignment can also be set using the algn parameter. The useful settings are l (left), r (right), ctr (centered), just (justified), and dist (text is widespaced to evenly fill cell width). Of course, if you’re setting these, marL should be set to 0. The simplest way to experiment with these parameters is to set the styles in the main text placeholder of the Slide Master (the larger slide at the top of the slide master list). Then unzip the presentation, open ppt/slideMasters/slideMaster1.xml and examine the <p:bodyStyle> section. The <p:otherStyle> section uses exactly the same syntax, so if you need bullets or unusual spacing in a table, you can set up <p:otherStyle> to do it.
Here’s what the final file should look like, with the changes highlighted:
What You Can’t Do
Each level definition includes references for Latin (a:latin), East Asian (a:ea) and Complex Script (a:cs) fonts. In similar Style parts like bodyStyle, you can replace +mn-lt with the name of a font so set that level in a non-theme font. But in the otherStyle part, PowerPoint completely ignores these entries, so much so that you can delete the three lines and PowerPoint will open the file without raising an XML error. This indicates that the program doesn’t even try to read those values. You also can’t specify different colors for different text levels in this XML part.
Fortunately, you can set fonts and colors for parts of the table in the custom table style, a completely different XML part from the otherStyle section of the slide master. For more about table styles, please see the articles linked to below.
Preview the Effects
When you’re finished editing, save and close the file. In a folder window where you can see all the unzipped files, select the folders _rels, docProps and ppt, plus [Content_Types].xml:
Zip them into a file that ends with the same file ending as the original presentation, usually .pptx. Open in PowerPoint, insert a table and test your new default font sizes. Please note, assigning these styles makes them available to the whole table, but to access them you still need to use Increase List Level, same as in an ordinary text placeholder. Unfortunately, there’s no way to automatically assign <a:lvl1pPr> to table headings and <a:lvl2pPr> to the body of the table, which would be cool and helpful.
In the otherStyle section, you can also set linespacing, space before and after, tabs and several other text attributes. Some of these have little effect in a table. In a Word table, adding space before or after has a similar effect as changing the top or bottom cell margin. Not so in PowerPoint. Space before and after in a PowerPoint table has no effect on the cell height. 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.
To find out more about creating table styles in PowerPoint, please read my two-part article XML Hacking: Custom Table Styles and XML Hacking: Table Styles Complete.
We’re available to create custom table styles for you, just email me at email@example.com