Font themes are one of the simpler theme elements in Open Office XML, but for some baffling reason, Mac Office users can’t create one. It’s odd enough that the only Mac program that can create a color theme is PowerPoint, but even it can’t provide an escape from Calibri and Arial! So I’m going to show you how to do it on your own.
Let’s start with a dead-simple font theme. Here’s the minimal file that Office will read:
Important Note: If you copy and paste this sample, you must change the non-breaking space characters to ordinary spaces. I need to use non-breaking spaces to format an HTML page, but Office will refuse to display your font theme if you don’t search and replace them with regular spaces.
You can create this in any text editor, including TextEdit in plain text mode (don’t try this with an rtf file). However, by default TextEdit will change the necessary straight quotes to smart quotes, producing a file that Office will not recognize. If you’re using TextEdit, make sure you visit both TextEdit>Preferences and Edit>Substitutions and turn off Smart Quotes in both locations. A better alternative is the free version of BBEdit. When you visit this link, click on the Download link to get the free version. If you do any significant amount of XML editing, the paid version of BBEdit is well worth the $50 price tag.
The most common font theme problem is using smart quotes (Hex 201C + 201D, Decimal 8220 + 8221) other than plain straight quotes (Hex 22, Decimal 34). But you can also ruin a font theme by using non-breaking spaces (Hex A0, Decimal 160) instead of regular spaces (Hex 20, Decimal 32). Even though a font theme is encoded in UTF-8, you should only use plain ASCII characters for the text. XML has a low tolerance for non-standard characters.
Now that you’re set up to edit, copy and paste the font theme file. The <a:latin> tag is the standard font for your theme. <a:majorFont> is for headings and <a:minorFont> for text. Fill in <a:ea> with a font that supports Chinese or Japanese (ea stands for East Asian), if you want to support those languages. The <a:cs> tag stands for complex scripts: Arabic, Thai, Hebrew and many more. For more detail on non-European language support in font themes, please see my article XML Hacking: Font Themes Complete. Or you can just leave those tags blank if you have a predictable user base that won’t require them.
A common mistake is to get too specific with the font name in font themes. The name is only the base font name as displayed in Powerpoint’s font menu. “Open Sans” will work, but “Open Sans Extrabold” will cause Word 2011 to display a blank space where the font theme should be, while Word 2016 will simply ignore the entire file.
Save the file as a text file with a .xml ending and give it the name you want to appear in the user interface. “Brandwares.xml” will appear in the Font Theme menu as Brandwares.
For Office 2016, 2019 and 2021 save this file to Users/YourUserName/Library/Group Containers/UBF8T346G9.Office/User Content/Themes/Theme Fonts. For Office 2011, save it to Users/YourUserName/Library/Application Support/Microsoft/Office/User Templates/My Themes/Theme Fonts. In current versions of OS X, the user Library is hidden by default. To open it, hold down the Option key, while clicking on the Go menu and choosing Library.
Once it’s correctly installed, it will show in PowerPoint’s Slide Master view under the Fonts dropdown. A new Custom group will appear at the top of the list, with your font theme in it. Once you apply it and a color theme to a presentation, you can save as a theme file and distribute that to your users, it will contain the font theme you just created. Happy hacking!
Font Themes – An Alternate Method
March 2017 edit: If you have any problems creating a font theme from scratch, here’s a workaround. Open an existing font theme that come with Office and edit the font names to the ones you want to use. These files are the verbose style discussed in this article: XML Hacking: Font Themes Complete. For most uses, you only need to set the a:latin font in the a:majorfont and a:minorfont sections. Here’s where you can find the Microsoft Font Themes:
Office 2011 for Mac – Open Applications/Microsoft Office 2011/Office/Media/Office Themes/Theme Fonts and copy any of the XML files.
Office 2016 or 2019 for Mac – Open Applications, then right-click on Microsoft PowerPoint and choose Show Package Contents. Open Contents/Resources/Office Themes/Theme Colors and copy any of the XML files in there.
Here are the locations for 32-bit versions of Windows. If you’re using a 64-bit version of Windows, check the same path inside C:\Program Files (x86).
Office 2007 for Windows – Open C:\Program Files\Microsoft Office\Document Themes 12\Theme Fonts.
Office 2010 for Windows – Open C:\Program Files\Microsoft Office\Document Themes 14\Theme Fonts.
Office 2013 for Windows – Open C:\Program Files\Microsoft Office\root\Document Themes 15\Theme Fonts.
Office 2016 or 2019 for Windows – Open C:\Program Files\Microsoft Office\root\Document Themes 16\Theme Fonts.
Too complicated? We can help! Brandwares is a full service template creation service for all Office programs. Contact me at production@brandwares.com
Custom Table Styles are probably one of the more detailed hacks you’ll have to write. See the constructions details in my previous post. Besides the basic table format, there are 6 optional format layers you need to at least consider. In a minimal table style, you’ll need to include at least the Header Row, First Column and Banded Rows. Most users will expect to see these options. Total Rows, Last Columns and Banded Columns are less requested, you only need to include them if a design or client specifically requires them.
As mentioned in part 1, if you haven’t hacked XML before, please read XML Hacking: An Introduction. If you’re using a Mac, you should also read XML Hacking: Editing in OS X. In addition, an essential companion to this pair of articles is the post on setting Default Table Text, which is set in a different XML component..
Let’s take a look at how our work appears in the PowerPoint interface. First, we’ll insert a plain vanilla table. By default this takes on colors and fonts from the current PowerPoint theme:
Next, we choose the Table Tools>Design tab, open the Table Styles gallery. Up at the top a new Custom section has appeared with our new custom table style:
Select the custom table style and the default table changes to match our design. This screen shot has all formatting options turned off, so effectively we are seeing the Whole Table formatting only.
Table Style Options: Banded Rows and Header
Using the options panel in the upper left corner, we can add some of optional formatting layers we created in XML. First, let’s turn on banded rows. If you remember, we only formatted odd-numbered rows, so the banding only changes rows 1 and 3 in our example:
Next, we’ll leave banded rows on and also add the Header row. This row doesn’t count as part of the table body, so the banding moves down 1 row:
Table Style Options: First and Last Columns
Next, we’ll turn off banded rows, leave the Header as is and add the first column:
Here’s the table with First and Last Columns checked:
Table Style Options: Header and Total
And finally, Header and Total Rows:
As you can see, with some pre-planning, one table style can cover quite a few related table looks. The layer options for different features make the table useful for many different purposes and the options panel makes it fast and easy for users to try different combinations. This feature is a major advance over tables in PowerPoint 2003 and earlier, which were quite crude by comparison.Table styles a similar way in Word, PowerPoint and Excel. While Word and Excel include table style editors in their interface, PowerPoint needs to be hacked to create them. Sadly, the table style specs for the different parograms are dissferent, so it’s not possible to trasfer tables style OOXML among Word, Excel and PowerPoint.
Table Styles: What You Can’t Do
You cannot set vertical cell/row alignment or cell margins in default taxt table text or a table style. It would have been possible given the OOXML spec, but Microsoft just didn’t bother.
Of course, if the process is too complex, we’re here to help. The current price on a custom table style is US$120. Just email me production@brandwares.com
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:
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.
Line 2 is the container tag that holds individual table styles. The last part of the tag includes the def tag that sets which table style will be used as the default. Paste in the GUID of your custom style here to make it the automatic style in a template or presentation.
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.
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.
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.
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:
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:
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.
In my last post, I looked at adding extra color themes to PowerPoint masters. But any color theme can only hold a maximum of 10 colors (not counting the hyperlink colors, which are not available in the color picker). The solution is to add Custom Colors to the theme.
Fortunately, most desktop versions of Office programs beginning with 2007 have a hidden capacity to display up to 50 additional colors. These form a new row below the theme colors and above the stock Microsoft row. These extra colors are not supported in PowerPoint 2008 or 2011 for OS X. While these versions will open a file with more colors, the colors do not get added to the color picker. Here’s what the color picker in every other variety of Word or PowerPoint looks like after adding additional colors:
Custom colors do not appear in PowerPoint for iOS, PowerPoint for Android or PowerPoint for the web. The web version of Office is also used in SharePoint, so SharePoint users won’t see them. You must be using PowerPoint for Windows or for Mac to see them.
OOXML Basics
If you’re new to XML hacking, be sure to read my Introduction to the subject first. If you’re editing on a Mac, there are some other considerations covered in this article. I should also clarify: a Color Theme or a Font Theme are only sub-parts of a Theme as saved by PowerPoint. A PowerPoint Theme file contains the entire presentation, including masters, layouts, and full theme files. It’s this full theme file that we need to edit. Custom colors never appear in a Color Theme file.
As with the extra color themes we looked at last time, custom colors are added to the XML theme files found in ppt>theme. I mentioned in the last article, presentations almost always include a default Office theme as a fallback and this theme is always last in the list. So in a presentation with 1 color theme, there will be a theme1.xml and a theme2.xml inside the theme folder. Ignore theme2.xml and customize only theme1.xml.
Setting Custom Colors
These colors are the last category in a theme file, so it’s easy to find. As before, we expand the PowerPoint file (really a zip archive with a different file ending), open ppt/theme, open theme1.xml in a text editor and reflow the text to be humanly readable. Then scroll all the way down to the end. An unmodified file will only display the <a:extraClrSchemeLst/> self-closing tag. To add more colors, we add a new branch to the tree. Below <a:extraClrSchemeLst/>, we type a new entry: <a:custClrLst>. This is followed by our additional color definitions and the closing tag </a:custClrLst>. Here’s what a list of custom colors as seen in the screenshot above would look like in XML:
A nice feature here is that, unlike color themes, you can actually supply a name for the color. This is followed a hexadecimal RGB color value, as used in web design. This list has only 8 colors, but there is room for up to 50 in the color picker. If you read the last article about color themes, you’ll soon realize that each theme file can have a different set of additional colors that goes with it as well. The combination of themes and custom colors gives you 18 colors per theme to play with, almost enough for the most color-crazed designer!
Custom colors can be added to the theme1.xml file in Word and Excel using exactly the same syntax. The colors appear in the color picker as expected in Word but are partially ignored in Excel. In Excel, these colors display for almost all objects on the Insert tab: Text Boxes, Shapes, SmartArt, Charts, WordArt, etc. But if you’re seeking to format worksheet text, cell fills or borders, they do not show. (Thanks to reader Kaz for pointing this out.)
Custom Colors in Columns
By default, the colors appear in 5 rows of 10 colors each. Some designers prefer to display the colors in columns instead of rows. To work around this, add your colors to form the top row of your columns. Then complete the row of 10 with dummy colors that have a value of FFFFFF and blank as a name:
Another limitation is that if you save a presentation as a Theme (*.thmx) file, custom colors in the presentation don’t get added to the Theme file. You’ll have edit a saved Theme file to add the custom colors to it, then they can be applied to another file. Or you can save the original presentation as a Presentation (*.pptx, *.pptm) or Template (*.potx, *.potm) to preserve the Custom Colors.
By extension, this also means that to add custom colors to Word by applying a PowerPoint Theme file, you must edit the Theme file to add the custom colors. Or course, you can hack the Word document or template to get them. The file name in Word will be the same: theme1.xml, but it is to be found in the word/themes folder instead of ppt/themes. As with PowerPoint, custom colors are added to the very end of the theme.xml part.
If you have added custom colors, then duplicate the slide master, the custom colors will also be duplicated (each slide master has a separate theme file as well). But if your first slide master has custom colors and you simply create a second slide master, the second master will not include the custom colors in it’s theme.
Unlike theme colors, custom colors are not automatically applied to charts. Automatic chart coloring in PowerPoint, Excel and Word is limited to 6 settable colors (see this post for chart coloring details). After that, the host program starts generating automatic variants based on the theme. However, for the detail-oriented among us, manual recoloring of data series with custom colors is very convenient and miles above the previous technique, inputting RGB values from text.
I’ve written a lot about PowerPoint, but the additional colors can be used anywhere in Word as well. In Excel, you get partial access. Most objects on the Insert tab can have custom colors applied, like AutoShapes and SmartArt. Custom colors cannot be used for worksheet formatting. Cell and font coloring won’t use use them, they just don’t appear in the color picker for those objects.
We’re here to do this for you, if you prefer! Please contact me at production@brandwares.com. Next time, I’ll tackle formatting custom table formats in XML. This is a complex subject, so it will take at least 2 posts. Stay tuned!
This article presents some new ways to use color themes. To find out more about how color themes work in PowerPoint and other Office programs, please read this companion article as well: Great Color Themes – Brandwares Best Practices.
The simplest way to give a presentation variety through different topics is to apply new color themes. If you ever worked with pre-2007 versions of PowerPoint, you may remember that you could have unlimited numbers of Color Schemes (as they were called), that you could easily apply to groups of slides to give them visual cohesion with one another.
With the 2007 XML version of Office, that simplicity went away. Instead, a master slide could have only 1 Color Theme. Applying a Color Theme to a single slide now applies it to the master and every slide based on that master. For most presentations, it’s all or nothing with new colors. Fortunately, I figured out a workaround that brings back much of the color flexibility of earlier versions. Vari-colored sections are back!
There’s still a limit of 1 theme per master, so now we have to create additional master for every different theme we want to use. Typically these themes will be closely related, with only 1 or 2 colors varying per theme. Sometimes the colors stay the same, but only change position in the theme. I’ll get into how you use that later.
This screen shot shows the Master Slide (the larger one at top) followed by its Slide Layouts below. To add more Color Themes, we begin by copying the Master Slide. The copies of the Master don’t have to duplicate all the slide masters. If different colors are only needed for a chart, we’ll just attach one chart slide layout to the new master slide.
Then we create new color themes, attaching one to each master. After this, you could save the template and make a perfectly good presentation. To get the different color theme, you reapply layouts from different masters and the colors come along for the ride. However, it’s a non-intuitive way to apply colors. To create a better user interface, we need to hack some XML!
3 Slide Masters in 1 presentation, showing the color theme attached to each.
To begin, review the instructions in my previous post about opening Office files in a text editor. If you’re editing in OS X, there are operating system issues you need to watch out for. I cover them in XML Hacking: Editing in OS X. The files we’re going to modify are in the ppt>theme folder. When open it, you see 4 files:
A presentation with 3 masters always has 4 themes, unless you take precautions.
By default, PowerPoint always saves its Office themes as the last in the list. The way around this is to create a new, blank presentation, then create color and font themes before saving for the first time. If you save first, the default Office color and font themes will be saved into your template in last place. You can always ignore the last file in the themes folder. We’re only going to edit the first 3. When you open up Theme1.xml and expand it to readable form, the first part of the theme looks like this:
Theme names that appear in PowerPoint, plus the color associations.
The editing were’ going to do occurs at the bottom of each theme, so let’s scroll down. The screen cap below shows the end of an unedited theme. The part we’re going to expand is the extraClrSchemeLst stub.
First we split <a:extraClrSchemeLst/> into opening and closing tags: <a:extraClrSchemeLst> and </a:extraClrSchemeLst>. Then we can insert color themes between them. When we’re editing the Custom theme that is applied to slides by default, we can color themes for the other themes 2 and 3. Here’s the first extra color theme: I just opened theme2.xml to get the values for this.
The first Extra theme takes values from theme2.xml.
Then add the color scheme from theme3.xml and save. Theme1.xml is complete.
Now open theme2.xml and add extra color themes from theme1.xml and theme3.xml. Finally add the colors from theme1.xml and theme2.xml to theme3.xml. Phew! Now every theme contains every color theme. Zip all the xml files back into a presentation and let’s see how this improves the user experience in PowerPoint. After opening the file and moving to a chart that is based on the default master and theme, we can click on Design:Colors and the extra color themes show right at the top of the list:
The extra color themes added to the master are shown circled.
Selecting an alternate color theme instantly recolors the chart on the selected slide:
An alternate theme is selected and the chart changes colors.
Thanks for reading. Next time I’ll discuss how to add even more custom colors when they won’t all fit into a color theme. If XML hacking isn’t your thing, we can do it for you. Contact me at production@brandwares.com.
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:
<a:lvl1pPr marL="0"
<a:lvl2pPr marL="457200"
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.
This gets asked a lot, but the answer is no: you cannot set vertical cell/row alignment or cell margins in default taxt table text or a table style. It would have been possible given the OOXML spec, Microsoft just didn’t bother.
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.
With the introduction of Office 2007, Microsoft changed the basic file format that underlies Word, PowerPoint and Excel. Instead of the proprietary and mostly undocumented format that ruled from Office 97 to Office 2003, Microsoft made a smart decision and switched to XML. This is tagged text, similar in structure and concept to HTML code with which you may already be familiar.
XML opens up a world of possibilities for automated document construction, but that’s a topic for another day. The everyday relevance for you and I is that if a Word or PowerPoint file isn’t doing what you need it to do and there are no tools in the program for the job, we can now dive in a edit the file ourselves. If you’re a point-and-click user, this is probably not thrilling. But if you’re a hacker at heart, a midnight coder or just a curious tinkerer, you can do some cool stuff.
The main tool you’re going to need is a text editor. While you can get away for a while with Notepad or TextEdit, those simple text editors don’t quite have the tools that get the job done efficiently. On Mac, I use BBEdit and on Windows I reach for Notepad++. BBEdit is reasonably-priced shareware and Notepad++ is freeware. They have a similar style of operation, so if you’re a cross-platform hacker it’s easy to switch between them. Notepad++ uses a plugin system, so you can add tools. For this job, you’re definitely going to want the free XML plugin. To install that, choose Plugins>Plugins Admin, scroll down the list to XML Tools, select it and click on Next. While you’re installing, aAnother very useful NotePad++ plugin is Compare.
The macOS requires somewhat more care with handling expanded Office files, or they won’t open after being rezipped. Please see this article for the best procedure on a Mac. The rest of this article mentions Windows methods, but the XML file structure is the same on both platforms.
Word, Excel and PowerPoint files in the new format are actually simple Zip files with a different file ending. Getting into them couldn’t be easier: if you’re using Windows, add .zip to the end of the file (a copy of the file, if it’s anything important). You’ll get a warning from your OS, but you know what you’re doing! Now unzip it. Out pop several folders of XML, plus a top-level file or two.
Select one of the files and open it in your text editor. All the files have been linearized to minimize file size. This is where your XML tools come into play. In Notepad++, choose Plugins>XML Tools>Pretty Print (XML Only – with line breaks). Now you have a nicely indented, easy-to-read page to edit. When you’re done, it’s not necessary to re-linearize. Word, PowerPoint or Excel will do that for you later.
For people using Window’s built-in zip utility, there is an easy mistake to watch out for. By default, unzipping a file in Windows creates a new folder named for the file being expanded. If, when you’re re-assembling the file, you include this top-level folder, PowerPoint will raise an error about unreadable content in the presentation. To avoid this, first open the folder that Windows created. Select the _rels, docProps and ppt folders, plus the [Content_Types].xml file, then create a zip file from them.
As an alternative to unzipping/rezipping files in Windows, download the free 7-Zip utility. After installing, set your text editor as the 7-Zip editor. Then right-click on the Office file you want to edit and choose 7-Zip>Open Archive. A window opens showing the OOXML folders and files. Find the file you want to edit, right-click and choose Edit. Edit only 1 file at a time in 7-Zip, closing your text editor and updating the file each time. Otherwise, some or your changes may be lost.
XML hacking is useful for Excel or Word when you want to add additional color themes, lock graphics, or when you need to rescue a corrupt document. But it really shines with PowerPoint, allowing you to create custom table formats, extra custom colors that don’t fit into a theme, setting the default text size for tables and text boxes, and more. This technique separates the PowerPoint pros from the wannabes.
In my next post, I’ll get into the specifics of some cool XML hacking Office tricks. In the mean time, check out text editors and XML tools so you’re ready to hack!
Subscribe to the Best Practices blog and get a free copy of our new Control Control add-in. This is the easiest way to create the same modern form controls that are in Word for Windows. Enter your real email and hit Subscribe in the right-hand column of this page. You’ll receive the add-in and installation instructions within 3 days.