In Word for Windows, you can select a Table of Contents and then add it to the TOC Gallery using References>Table of Contents>Save Selection to Table of Contents Gallery (highlighted in red below):
Unfortunately, Mac versions of Word do not share this feature. But it’s a super-simple hack. If you are new to XML editing, please read XML Hacking: An Introduction. MacOS users should also read XML Hacking: Editing in macOS to avoid a couple of Mac-specific XML issues. The latter article now mentions the free XML editing plugin for the Chrome browser in the July 2018 update.
You can also use this hack to add content to other Word Galleries, like the Cover Page Gallery. Please see the last section of this article for the details.
Add a Table of Contents to the TOC Gallery – The Steps
Make sure you’re working on a template rather than a document. We’ll be using AutoText, and AutoText is saved to the template. If you’re working on a document, the AutoText would get saved to the template attached to the document, not the document itself.
Start by making the invisible characters visible, using Word>Preferences…>View and checking All in the Show Non-Printing Characters section.
Now select the custom Table of Contents, making sure to include the paragraph mark just below it.
Set the Look in: dropdown to the name of the template you’re working on.
In the Enter AutoText entries here: field, give the AutoText entry a sensible name like Clientname Custom TOC.
Click on the Add button and save the template. Close Word.
Open the template file in your text editor or Chrome browser with the OOXML plugin.
Navigate to word/glossary and open document.xml, the home of all AutoText.
Search for the name you gave the TOC AutoText entry. The first few lines should look something like this:
Make 2 changes in the <w:category> section:
1. Change the w:name value from General to a more meaningful name like Custom TOC. This will display as the heading under which your custom TOC appears.
2. Change the w:gallery value from docParts to tblOfContents. This is the crucial step that makes the TOC appear in the TOC Gallery.
Resave the template file, close the editor and open it in Word.
Choose References>Table of Contents, scroll down to the Custom TOC section and choose your custom TOC.
Add Content to the Other Word Galleries
You can use exactly the same steps to add a custom cover to the Cover Gallery. Just change the w:category w:name value to Custom Covers and the w:gallery value to coverPg. Use the table below to find the values used for other gallery type.
Please note, the category names are Microsoft defaults, and yes, they are inconsistent whether they spell it Built-in or Built-In. Using these will group your entry with them. If you want your own category, just use a different word or phrase and Word will add it on the fly. To make the category pop to the top of a list, include a space in front of the name (Thanks to Timothy Rylatt for the suggestion):
w:category w:name Values
Page X, Page X of Y, Plain Number, Plain Text, With Shapes
Page Numbers (Bottom of Page)
Page X, Page X of Y, Plain Number, Simple, With Shapes
Page Numbers (Margins)
Page X, Plain Number, With Shapes
Page Numbers (Top of Page)
Page X, Page X of Y, Plain Number, Simple, With Shapes
Table of Contents
Confidential, Disclaimers, Urgent
If this looks too geeky for you, we’re glad to help! Brandwares is full-service template creation service specializing in working with graphic designers and corporations. Contact me at email@example.com.
Last time, I wrote about how to make great color themes. But what about if you (or your client) have discovered that an existing color theme has a problem. If you catch them early, most issues with color themes can be corrected using PowerPoint’s user interface. Say you’ve created a theme or template, but some of the tests in the last article show problems. Repairing color themes requires rearranging the theme colors, then recoloring any graphic elements on the Slide Master and Slide Layouts.
If you didn’t test the template or theme and you’ve already created a presentation before finding the theme problem, it’s more work to fix. Follow the same sequence: rearrange the colors in the theme, fix the Slide Master, then the Layouts and finally repair any element on each slide that still needs help.
But what about if there are multiple templates, or several decks that have been created from a faulty theme? Repairing color theme problems manually quickly becomes an ordeal. It’s time-consuming and error-prone to try to make all the changes by hand. Searching and Replacing using a text editor would be much quicker and more thorough. It’s time to hack some XML!
We’re going to fix all the color theme problems by searching for XML text and replacing it with corrected values. Professional test editors really shine for this kind of work because of their abilities to do search and replace on multiple folders full of files, saving you hours of work. NotePad++ for Windows and BBEdit for macOS are 2 excellent choices for this work, they both have multi-file search and replace.
If you’re using Windows, unzip the files in a separate folder. On a Mac, open the theme or template in BBEdit.
Start by correcting the color order of the theme file located in ppt\theme\theme1.xml. During design, you may have applied more than one theme and PowerPoint hoards them all. If you have more than one theme file, check the name attribute to ensure you’re changing the one actually used in your deck. (If the theme is called Office Theme, that’s a Microsoft default, you don’t have to update it.) You may also have more than one theme if your presentation contains more than one slide master. Here are before and after examples, showing only the first 4 colors:
This has blue in the lt1 (Light 1) slot and white in the dk2 (Dark 2) spot. One symptom is inserted SmartArt that shows blue text instead of the expected white.
If a presentation uses Chart Templates, you may also see files in the Theme folder like themeOveride1.xml. This override component allows a chart template to have a color theme different from the presentation into which it’s placed. All chart templates created from a template contain this themeOverride component, which is simply a copy of the main color theme. If the template color theme is bad, then you’ll also have to open all the chart templates and update chart/theme/themeOverride1.xml.
Repairing Color Themes – The Slide Master
For our simple example, we can skip this step, but for more complex repairs, it may also be necessary to adjust the color map in the slide master. If the presentation was based on a color theme exported from Word or Excel, this is necessary. It’s also often needed for legacy decks that have been imported from PowerPoint 2003 and earlier.
The Slide Master has 2 parts. First is the slide formatting that displays in the Slide Master view of PowerPoint. It’s tagged with <p:cSld>. Immediately after that are parameter storage sections holding references to the slide layouts, title, body and other text formatting, etc. The very first section <p:clrMap is what we’re looking for. The full default color map looks like this:
You can see that the dark colors dk1 and dk2 are mapped to the background instead of the text, while text is formatted with lt1 and lt2. The color theme hasn’t been altered, just the way it is mapped to the presentation elements. There is nothing in the program interface to fix this, you must edit the XML. Mental organization becomes very important when changing both the theme and the color map, you can easily get confused.
Repairing Color Themes – Search and Replace
The above steps are preparatory to making the actual changes. Now we need to change the color tags attached to all affected elements in the Slide Master(s) and all Slide Layouts and Slides. Let’s use the example of switching the blue and white. The blue was in the lt1 slot, which is mapped in the Slide Master to bk1 by default. The white was in the dk2, mapped to tx2. After switching the color order, we need to change all bk1 color tags to tx2 and all tx2 tags to bk1.
Wherever a tag is used as an attribute, it has straight quotes before and after. Include these in your search terms so you don’t mess up the color map in the Slide Master. It’s simplest to run this on all files in the archive:
Find what: “bk1” – Replace with: “tx22”
Find what: “tx2” – Replace with: “bk1”
Find what: “tx22” – Replace with: “tx2”
That should do it! Zip up the files with the same file ending as the original, if you’re using Windows. On the Mac, just save the file. Test in PowerPoint.
This is the simplest repair scenario. Sometimes you have to move more colors around, particularly if the creator was someone unfamiliar with PowerPoint. Make notes ahead of time, to make sure you’ve got the right colors moving to the right slots. And always work on a copy of the file, not the original! If it gets too complicated, just send it to us, we do this kind of thing all the time.
Next time, I’ll be discussing PowerPoint SuperThemes. Brandwares has cracked the construction of these, so I’ll cover what you need to know.
Recent colors are handled inconsistently by Microsoft Office programs. Word and Outlook only retain recently used colors only as long as the program is running, and those colors are visible in every document that’s open. By contrast, PowerPoint and Excel both include them in the document. As soon as you open a different file, the previous colors disappear from the color picker. Return to the first document and there they are again.
If you’re creating files for clients, you may generate quite a few colors in the design process. Your work will look a little more professional if you purge the Recent Colors from the PowerPoint or Excel file before sending it on.
The row of Recent Colors that PowerPoint and Excel include in the file is a distraction for your client.
Recent Colors Removal Steps
Under Windows, begin by unzipping the file. On a Mac, open it in BBEdit or other advanced text editor.
If this is a PowerPoint deck, look in the ppt folder for the presProps.xml file. The recent colors begin on the third line of a prettified (human-readable) file. Simply delete the entire clrMru section:
After editing, rezip the files if you’re using Windows or save and close in your macOS text editor. Test that the file opens as expected and no longer has Recent Colors in the color picker, that send it off to the client.
A more presentable dialog for your client.
Don’t Reuse Recent Colors
Occasionally an artist will try to include special colors in the Recent Colors section, to give the client some additional color choices. This is a bad idea because the Recent Color section is dynamic. When any new color is created, it’s added to the left end of Recent Colors. If the row is full, the oldest color gets pushed off the right end. A better solution is to create Custom Colors. Here’s my how-to on the subject. Custom Colors don’t move or change and can be named, which is a little extra help for your client.
I wrote about how to create a basic font theme in 2015: XML Hacking: Font Themes. Thanks to everyone for the comments and feedback that have allowed me to refine the article and make it more helpful.
That article covered a bare bones font theme for European languages (referred to as Latin fonts in Microsoft-speak). International and multilingual users require a theme that can work with a greater variety of languages and fonts, so in this article I’m going to cover how these work and how to create them.
A More Complete Simple Theme
There’s more we can do with the very basic theme from the previous article. In the listing below, a font has been specced for only Latin fonts. Important Note: If you copy and paste these samples, 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.
In both the Major (Headings) and Minor (Body) categories, there are also ea (East Asian) and cs (Complex Scripts) entries. These theme entries are inactive until text is formatted as a relevant language. As long as your text is marked as US English (either by using the Review>Language>Set Proofing Language, or by setting the language in a Style), only the Latin theme fonts will be active. But if you mark text as Chinese, the Office program will check the theme and use the font in the ea tag instead. Likewise, Persian text will activate the cs theme font.
What will not work is to try to set an East Asian or Complex Scripts font in the Latin tag. Depending on the version and platform of Office, you’ll only get European characters showing, or the program will completely ignore your theme. Here’s a simple font theme that will work with Japanese, Arabic and European languages:
Depending on which ea or cs font you choose, it may support one or several languages. As an example, CJK fonts will support Chinese, Japanese and Korean. Of course, in a collaboration scenario, the fonts chosen should be available on both Mac and Windows, or the display of one of the langauges may get mangled with a font substitution. The best idea is to stick with fonts distributed by Microsoft with Office.
Complex Font Themes
When you crack open the XML on a document or theme, the font theme information is contained in theme/theme1.xml. This illustrates a font theme that is ready to take on the world:
For brevity, I’ve omitted the Minor font section. Instead of setting the ea and cs fonts, this font theme has entries for more tightly defined language groups and different fonts assigned to each one. This level of detail is necessary for a font theme that can be used around the world. Since I copied this listing from theme1.xml, it doesn’t have the XML opening that a standalone font theme would have.
For a complete list of all 4-letter script/language codes, search online for ISO 15924 Code Lists.
Setting up and testing a complex font theme like this is not a simple task. The font switching is automatic and is triggered by the language input setting on your computer, the language set in your template styles and the language set in the text being edited. Please post your comments, let me know of any hiccups or problems you notice and I’ll try to answer your questions.
Brandwares creates font themes to help global corporations support every language. Send me a message for ensure your files have worldwide useability: firstname.lastname@example.org
My last post began the subject of styled text boxes. There I covered the parameters contained in the first line of each level definition. Today’s entry continues by introducing the XML elements inside the level definition that format text. As a reminder, a level definition is the equivalent of a PowerPoint style. Since a text box can have up to 9 text levels, we can format 9 unique styles.
Styled Text Boxes – Child elements
Child Elements are XML parameters that are within an a:lvl#pPr level definition, as opposed to the first line values covered in my last post. Here is a super simple level with only 2 enclosed parameters, shown in bold:
In order, this block sets line spacing of 125% (or leading, for the designers), 12 points of space before and space after of 5 points. Finally, three left-aligned tabs are set. The units are EMUs, so these tabs are spaced 1/2″ apart.
Child Elements – Bullets
Out of 16 possible child elements, 11 are for bullet formatting. Creating bullets by editing XML is an exercise in frustration. It’s far easier to create bullets using the program interface and then transfer that XML to the p:defaultTextStyle section of presentation.xml.
Sure, you could do all of the above in a text editor, if you wanted to prove your coding prowess. But time is short and there’s a faster way to get this job done using PowerPoint’s program interface. This leverages the fact that the structure for list level text is exactly the same for p:titleStyle, p:bodyStyle and p:otherStyle as used in slideMaster1.xml, p:txBody, used in many slide layouts, and p:defaultTextStyle as seen in presentation.xml.
My preferred method is to start by making a copy of the Content with Caption slide layout, then deleting the title and content placeholder, leaving only a text placeholder preformatted with small text. Then I make 9 levels of text and format each to match a design or client specs for what the text box styles should look like. Do all your bullet formatting here. Save the file and exit PowerPoint.
Now expand the file and look in ppt/slideLayouts. The Content and Caption layout is usually slideLayout8.xml. If you duped it as suggested, open slideLayout9.xml and format the code to be humanly readable. Just below <a:lstStyle> are 9 level definitions with all the formatting you created in the program interface. Each level starts with <a:lvlXpPr where X is the level number. Copy all 9 level definitions, but not the starting <a:lstStyle> or closing </a:lstStyle> tags.
Now open ppt/presentation.xml, select all 9 level definitions (starting just below </a:defPPr>) and paste in the 9 levels from slideLayout9.xml. Save the file, zip everything back into a presentation. Each inserted text box should now have up 9 levels of styles that match the formatting you created on the duplicated layout. Delete the extra layout and you’re done.
Styled Text Boxes – What about the Font?
If you’ve tried these steps out, you might notice one glaring omission in the XML. When you format a slide layout and copy the XML, there is no font information in the level definitions. This is because the layout gets its font info from the slide master. There are 2 ways to fix this:
If all levels the text box are in the same font, open the presentation, create a text box, set the font, right-click on the text box and choose Set as Default Text Box.
This action fills an objectDefaults stub at the bottom of ppt/theme/theme1.xml. It looks something like this:
In this case typeface=”+mn-lt” sets the text box font to the Minor (hence mn) or Body theme font. The Heading theme font would appear as +mj-lt.
If there are different fonts for different levels, apply those fonts when formatting the duplicate slide layout.
Interesting fact: If a level is set by default to a theme font, clicking on the font dropdown and re-selecting the same theme font breaks the font inheritance from the slide master and specifies the theme font in the layout instead. Here’s the default XML from the layout level 1 again:
I believe this hack vastly increases the utility of the text box. In effect, it becomes a text placeholder that a user can easily add to any slide. Accessing the styles works exactly the same as a text placeholder. Use the Increase List Level button (Indent More on a Mac) to move through the levels.
Here’s a visual comparison of a text placeholder and a styled text box:
Styled Text Boxes – Other Issues
I’ve run across a couple of minor problems that you will need to keep in mind.
Picture bullets aren’t going to work. These require building an XML relationship to the bullet image stored in the file, which is very hard to do manually. Don’t bother.
Similar to the theme font issue mentioned above, default paragraph spacing in the layout is inherited from the slide master. This means your text box paragraphs will be missing any space before or after that displays in the layout. To fix this, set the paragraph spacing for each level in the layout. It doesn’t have to change, but you still have to set it to include the spacing in the layout XML.
PowerPoint’s text boxes could really use styles. But wait: they already do! Text boxes styles are built right into the file format, but there is no access to them thorough the program interface. Formatting text boxes using PowerPoint’s user interface is primitive compared to the styling that can be applied to placeholders in PowerPoint. There is no master where you can format text box defaults. The program interface only allows you to set one style, then right-click and choose Set as Default Textbox. And even this default disappears if you click on the Clear All Formatting button (Home>Font group, look for the icon with an eraser over 1 or 2 letters).
Text Box Styles XML
First, let’s clarify our terminology. Text styles in PowerPoint don’t work like any other program, because there’s no Style menu to apply to selected text. Instead, there are levels that you get to by clicking on the Increase List Level (Windows) or Indent More (Mac) buttons. Each level can have a different style.
Fortunately, with some judicious XML editing, you can create 9 preformatted levels of text for your text boxes. They can become nearly the equivalent of a text placeholder that you can add to any slide. This formatting includes line spacing, bullets, indentation, alignments and many other parameters, so this will have to be a 2-part article.
These text box styles will be saved in a theme, so they can be used in other presentations. However, if the theme is applied to Word or Excel, those programs ignore the custom styles and use their standard single-style text boxes. I guess we could expect that when all these settings are storing in a component called presentation.xml. If you’re new to this subject, read XML Hacking: An Introduction. If you’re using a Mac, you should also read XML Hacking: Editing in OS X.
The XML component that contains the text box text levels is ppt/presentation.xml. This component also contains presentation parameters like slide size, slide master ID and a list of slide IDs for all slides in the deck. Below those items is a tag called <p:defaultTextStyle> that contains 9 levels of text formatting. This structure is nearly identical to the text formatting used for default table text, covered in this article: XML Hacking: Default Table Text
Each of the text levels is identical except of a single digit in the name tag, so we can extract one level for an example that will work for all levels. When this is set up, you’ll be able to insert a text box, then click on the Increase List Level button (called Indent More in OS X) to move between styles, just like a text placeholder. Here’s a sample default level:
This contains 2 different sections: the first line, called an element, with a string of parameters, called attributes, plus the list of additional parameters on separate lines below, called child elements. It’s important to create the right data in the correct location, so for this article, I’m only going to cover the first line.
Text Box Styles: Attributes
From left to right, the default attributes are:
marL – Sets the left margin for that text level in EMUs. 914,400 EMUs equal 1 inch, while 360,000 EMUs equal 1 centimeter.
algn – Horizontal alignment. A value of l means left aligned. You can also use r for right aligned, ctr for center aligned, just for justified text and dist, which distributes text evenly across the line width, kind of like an extreme form of justification.
defTabSz – Default tab size, again in EMUs.
rtl – Is the language right to left? 0 means no.
eaLnBrk – East Asian Line Break: East Asian languages have rules about where a line break occurs. The 1 value turns this attribute on. A 0 breaks the line wherever needed, without consulting the rules.
latinLnBrk – Similar to the eaLnBreak, a 0 will not break the line without a hyphen, a 1 will break the line wherever needed without a hyphen.
hangingPunct – Theoretically, this forces puctuation to be on the same line as text or allows it to drop to a spearate line. Online documentation for this is poor and I couldn’t detect any difference in setting this to 0 or 1.
Those are the defaults. Then there are several optional parameters that you can add manually:
marR – You can set the right margin of text, in EMUs.
indent – Set the first line indent of each paragraph, in EMUs.
fontAlgn – Vertical alignment. Acceptable values include auto and base which both set text on the font baseline, which is the default. You can also use b to align with the bottom of the descenders (like the bottom of a g or y), t to align with the ascenders or ctr to center text vertically. This latter setting solves the issue that when you increase PowerPoint bullet size, you also increase the bullet elevation above the baseline. Using fontAlgn=”ctr” forces the bullet to stay aligned with the text whatever size it is.
lvl – Determines the numbering level for this text level, independent of the level’s position in the hierarchy of text box styles.
The picture below illustrates 5 levels of formatting in a text box. There is no local formatting applied, all I did was type the text and click on the Increase Indent button to move between levels, exactly as with a text placeholder.
5 levels of text box text formatted with only the first line <a:lvl#pPr> tag.
Text Box Styles: Obscure Gotcha
This XML group is called p:defaultTextStyle for a reason: it’s for other items besides text boxes. If you save you template and a PowerPoint theme (File>Save As>Save as type>Office Theme (*.thmx)), the slide master and layouts are saved in the file. Double-clicking on the theme creates a new presentation. But Handout and Notes masters are not saved in a theme, only in a template. PowerPoint creates new Handout and Notes Masters on the fly using its plain vanilla defaults. The Header, Footer, Date and Page Number placeholders are recreated from the p:defaultTextStyle levels. If the first level uses bullets, the placeholders will have bullets as well!
To get around this, format the first level without bullets, or distribute a template instead, which includes Handout and Notes masters that you can format to the design specs. I prefer templates, because you can also include sample slides.
We’re here to help. Brandwares can improve your PowerPoint project: We teach the pros! Contact me at email@example.com.
Recently I was creating a white paper template in Word for a client and needed to insert some custom Picture Content Controls for photos that would be inserted by users. The designer had specced round-cornered pictures, but Picture Content Controls (PCC) have square corners. It didn’t take long to figure out that after selecting the PCC, I could choose the Picture Tools>Format tab of the Ribbon, then apply a Picture Style. I chose the rounded corners with reflection (fifth icon over in Word 2010), then removed the reflection.
Now I had rounded corners, but also another problem. Word keeps the corner radius in proportion to the box size, so resizing the PCC up to the right size made the radius much larger than the design. Unlike AutoShapes, Content Controls will not display a yellow radius handle to adjust the radius. I also tried resizing the PCC before applying the Picture Style, but got the same big corners.
A Picture Content Control with default corner radius.
Custom Picture Content Controls XML
When I’m stuck, I crack open the XML. Can’t leave it alone! If you’ve never opened Office files to edit their XML, read XML Hacking: An Introduction. If you’re using a Mac, you should also read XML Hacking: Editing in OS X. All document content is in word\document.xml, so I opened it and started searching. In some respects, a PCC is handled like an ordinary picture, so I found it inside a <w:drawing> tag. The information I was looking for was in this subsection:
When I spotted the line <a:prstGeom prst=”roundRect”>, I was pretty sure that’s what I was looking for. But inside that tag, there were only 2 parameters. I went for the fmla tag and changed the value from “val 8594” to “val 4000”. Because I’m experimenting, I make only 1 change, then zip the XML to test. If you make several changes and the file doesn’t open, it can take a long time to find the error.
I reopened the Word file. Success! The corner radii were about half the size. Then I just had to try several values until I found one that match the designer’s intent. Keep in mind that the fmla value is not setting any particular radius size, it’s setting the ratio of the curve to the size of the picture. So you should make the placeholders the correct size first, then try out fmla values to get the radius you want at those dimensions.
You don’t always get lucky with parameters. A few lines down I spied another setting that looked like it could be useful. While you can set the PCC border in the program interface, you can’t set the fill color. However, in the XML, I saw these tags:
Unfortunately, changing these values had no effect on the color of the Content Control. So what do these tags do? Search me, maybe someone at Microsoft knows. But I was happy to be able to set the radii to my preference. Here’s the final result:
A custom Picture Content Control with smaller corner radii.
We can provide custom Content Controls and much, much more. Get pro help with your PowerPoint project by emailing me at firstname.lastname@example.org.
Multiple color themes in the same PowerPoint template are useful for companies with several divisions or for presenters who need color-coded sections. Here are 3 ways to add that capability to your presentations.
Multiple Color Themes: Using Super Themes in PowerPoint
PowerPoint 2013 and 2016 for Windows and Mac all feature a new theme format developed by Microsoft: the Super Theme:
The user sees a preview of the color palette that will be used, then picks the variant they want to use. It’s an elegant, attractive interface and makes the design variants plainly visible on the Ribbon. Super Themes also allow the inclusion of size variants, so that resizing a deck doesn’t distort the logos.
Brandwares now creates custom Super Themes, so we can make these for you. However, the technique is tricky, so if you’re an independent designer without the budget for professional assistance, you’ll have to find another way. Fortunately, there are other methods to add multiple color themes.
Multiple Color Themes: Hacking XML
This technique works to add multiple color themes to PowerPoint. You can also add them to Word and Excel files, but those programs will simply ignore them. These extra color themes will travel with a theme saved from such a Word or Excel file, but you already knew that PowerPoint is the program to use for creating theme files. To hack the XML, start by reading XML Hacking: An Introduction. If you’re using a Mac, you should also read XML Hacking: Editing in OS X.
Now, expand your Office file to see the XML. Open the ppt folder, then open the theme folder inside that. PowerPoint saves every theme that’s ever been applied to the presentation, starting with theme1.xml, so you’ll have to check the theme name in each variant to get the right one. If you’re trying this with Word or Excel, look in word\theme or xl\theme respectively, where you will find only one theme1.xml file.
Format the XML to be readable, then go right to the bottom of the listing, where you’ll find the self-closing stub called <a:extraClrSchemeLst/>. First, open up the stub:
The syntax is exactly the same as for the clrScheme listing that every theme includes as its main color theme, so you can simply copy and paste the whole block of XML. The theme file can hold any number of extra color schemes. When you are using the final file, you can change the theme colors by choosing View>Slide Master>Colors in PowerPoint (actual menu names change in different versions of Office).
Clicking on the Colors dropdown shows the extra color themes.
When you choose a new color theme, all elements keyed to the color theme will change throughout the presentation.
Multiple Color Themes: Multiple Masters (PowerPoint only)
For Word and Excel, a document can have only one color theme applied at a time, and that theme affects all pages in the file. PowerPoint allows more flexibility, since it can have multiple master slides and each of those master slides has its own color theme. This means that different parts of a PowerPoint file can have different color themes. This is often used to color-code different sections of a presentation.
In its most basic form, this is the simplest technique. No XML hacking required:
In PowerPoint, choose View>Slide Master to view the masters.
Right-click on the Slide Master (the larger slide at the top of the left-hand display) and choose Duplicate Slide Master. The new master is added below the slide layouts for the first master. (In Windows versions, right-click and check that each Master has the Preserve Master attribute checked, or they’ll vanish later.)
Select the new master, then choose Color>Customize Colors.
Revise the color theme, or apply a color theme you created earlier. OK out.
Repeat the steps above for each different color theme you need to include. In the program interface, the user will see a group of slide layouts for each slide master. Here is a presentation where only one colors changes in each color theme:
While this is the simplest method to use, it’s not self-evident to all users that you change color themes by choosing a different set of slide layouts. So you’ll probably have to include at least an explanatory note with the template when you distribute it. But what if you want a premium solution for a high-end client? Read on…
Multiple Color Themes: XML Hacked Multiple Masters (PowerPoint only)
A solution that is simpler to use is to combine techniques 2 and 3. Create multiple masters, each with a different color theme. This will create a theme#.xml file in ppt/theme. Open all the theme#.xml file and copy the clrScheme for each to an extraClrScheme tag in all the others. So if you have 3 masters and color themes, copy the clrScheme tag for theme1.xml to an extraClrScheme tag in theme2.xml and theme3.xml. Then copy the clrScheme from theme2.xml to extraClrScheme tags in theme1.xml and theme3.xml.
The result is that it doesn’t matter so much which master you choose, you can change the color theme later. Of course, changing the color theme affects all slides based on the same master. This is an easy-to-use method for providing presentation with sections in different colors.
My thanks to Timothy Rylatt for his assistance with fact checking and corrections in this article.
Brandwares employees are world experts in PowerPoint template and theme creation. Send me a line at email@example.com for assistance with your project.
Locking graphics in Office documents must be #1 on most designers’ wish lists, judging by the number of requests we get. While Word and Excel already do a fairly good job of locking, they can still benefit from this technique. PowerPoint remains wide open. If you can see it, you can move, resize or delete it. Placing items on the Slide Master or Layouts helps, but this is minimal protection against a savvy user. Your users love to be “creative”, so how can we protect the brand from their enthusiasm?
Fortunately, it’s possible to provide protection for important logos and maintain slide layout integrity by editing the template XML. But this power comes with a responsibility to design the protection carefully. It can be a very thin line between a deck that is protected and one that is unusable. If you decide to protect your presentation, it is incumbent on you to test it repeatedly to ensure your users can still get work done with it.
Locking takes place mostly in the Slide Master and Layouts. A minimal approach is best, as each additional locked item will create more feedback from your users with the potential to increase tech support costs. On the Slide Master, you will probably only lock a company logo.
Locking Graphics: Logos
Start by placing a logo on the Slide Master. Of course, you’re not using a JPEG file, because you already know that’s the worst format for line art. If you still think JPEGs for logos are a good idea, please read JPEG Logos? Fail! and Logo Production Secrets. After the logo is in place, expand the presentation to view the XML. Open ppt\slideMasters\slideMaster1.xml. All the placeholder coding comes first, so scroll down about halfway until you see XML that looks like this:
Test this out by re-zipping the files and opening in PowerPoint. Try to select the logo. noSelect=”1″ has the effect of making it unselectable, so the user can’t do anything creative with it, even if they open the master.
This is a super-simple technique, but it has a potential down side. Many add-ins and VBA macros work on a presentation by going through every shape on a slide until it finds the one it needs to revise. The noSelect tag can play havoc with code like that and possibly cause the programming to fail for no apparent reason. So here’s a more professional lock that has the same effect, but won’t disrupt any add-ins:
Different graphic objects use a slightly different syntax. The noSelect=”1″ parameter remains the same, but you have to expand a tag and add a new line to include it. For all AutoShapes except lines, the default XML will resemble the following:
Placeholders are the boxes on slide layouts that can hold different types of content. The layouts are found in ppt\slideLayouts. They are numbered in the order that they appear in the left-hand list of layouts in Slide Master view. By default slideLayout1.xml is the Title slide. The XML tag is <p:sp> instead of <p:pic>, but otherwise the syntax is the same for locking. Placeholders do not inherit the lock parameters, so locking a placeholder on the master doesn’t affect the layouts and locked placeholders on the layouts have no effect on the slide placeholders.
You can see what other parameters are possible for the spLocks tag at Datypic’s a:spLocks page. There are options here to prevent grouping the image, rotating, moving or resizing it, changing it’s aspect ratio and several other less useful options. Let’s use some of the other parameters to lock down the shape. Here is the start of a Title placeholder:
Don’t expect that slides based on this will still have unmoveable placeholders. The lock parameters are not included when a slide is created from a layout. This locking ensures only that the layout remains the same, so when a slide is reset, it will always return to the correct format.
If the placeholders must remain in place on the slides, then you must first create the slide, then edit the XML before distributing the deck. For this, look in ppt/slides. The files are numbered in the order they appear in the presentation, so slide1.xml is usually the title. Here is the XML for a locked title placeholder:
When the user clicks on this, all the adjustment handles have a diagonal through them and the user is unable to change the shape size or position:
Locking Graphics: Other Objects
By default, the picture and placeholders already include a p:locks or sp:locks tag, which is where we add the locking information. But what if you insert a text box on a layout for a legal disclaimer and want to make it ineditable? The text box XML initially looks like this:
To lock this, we need to expand the <p:cNvSpPr txBox=”1″/> tag. In case it’s not obvious, to expand a closed tag, you must first delete the slash at the end that closes it. Then you create a new closing tag and put the <a:spLocks>> information between the two. The noTextEdit parameter means the text can’t be edited. Even if a clever user gets to the slide layout, they can’t change the text, though the shape is still moveable.
PowerPoint users who can’t afford a graphic designer love the Design Ideas feature in PowerPoint. As I write this, this feature is only available in Microsoft 365, the subscription version of Office. Microsoft uses AI technology to present the user with designs that Microsoft thinks are relevant to your content. Any company with branding guidelines should turn this feature off for their users.
Many Design Ideas have shapes that are locked in the XML. When Microsoft locks a shape, they throw the kitchen sink at it:
Some of those locks don’t even make sense for most shapes, like noChangeArrowheads. The only lock they don’t apply is noSelect, avoiding the macro problem I mentioned earlier. To turn the lock shape into something you can copy, paste and revise, just delete all the attributes:
Locking Graphics in Word and Excel
The principles are very similar to locking in PowerPoint. This can give you locked graphics and/or ineditable text boxes in both those programs without have to apply any document protection.
In Word, picture locks must be applied to the graphic frame that holds the picture, not the picture itself. This works:
After a few months of practical testing, some real-life limitations on shape locking have become evident. Adding the noChangeAspect=”1″ has the same effect as checking the Lock aspect ratio option on the Size pane of the Format Shape dialog. But just as when you check this option manually, clicking on the shape and dragging the adjust handles will still distort the shape. On top of this, I found this page on MSDN: 2.1.1255 Part 4 Section 22.214.171.124.34, spLocks (Shape Locks). The pages states that “Office ignores attributes noChangeArrowheads and noRot when applied to a shape. PowerPoint additionally ignores the attribute noAdjustHandles when applied to a shape and noChangeShapeType when the converting the shape to a freeform.” So a user can circumvent noChangeAspect by dragging on the handles and you can’t prevent the handles from displaying either. Office simply doesn’t implement Microsoft’s own spec completely. There’s nothing you can do about this. It should be noted, that the accuracy of Microsoft’s information is not the best. Their statement that Office ignores noRot=”1″ when applied to a shape is not true, you can successfully prevent rotation with this parameter. You really have to test everything to really know what works and what doesn’t.
Locking Graphics: The Designer’s Responsibility
Powerful? Yes. But with power comes responsibility. Company presentation templates need to be revised, but after you lock items in XML, those shapes can no longer be revised through the program interface. So it’s essential that if you use these techniques, that you document your changes when you send the file to your users. Using these methods secretly to get repeat business from captive clients is dishonest and is definitely not a best practice.
Brandwares knows every detail about shape locking and we can do all this for you. Email me with the details of your requirements at firstname.lastname@example.org.
I’ll admit right off the bat, graduated color table borders is a trick you might need only once every ten years. But it’s a good illustration of the little touches you can add with XML Hacking that you just can’t do any other way. If you’re unfamiliar with XML hacking, please read XML Hacking: An Introduction. If you’re using a Mac, you should also read XML Hacking: Editing in OS X.
I was working on a presentation for a designer and the theme used graduated color rules. Most of the layout only need a rule below the title, which was simple to do with user interface. But then the designer included a slide that clearly needed to be a table and that table had the same graduated colors used as horizontal borders. At first, I informed him this wasn’t possible, but as I researched the issue, I found there was a way.
The answer was in a 10-year-old blog post by Mike Fried. Back then Mike was one of the engineers creating Office 2007 and his 2 posts on PowerPoint table styles have lots of good information. Toward the bottom of the article, he included garish graduated color table borders. It was enough to crack the code.
As an aside, I’d like to mention that you can find out the details on any Open Office XML parameter by Googling it. There is extensive documentation on the web, even though some of it is terse database excerpts. The essential command for a gradient line is a:gs. The GS stands for Gradient Stop, the points on the line that define where a particular color appears in the graduated line.
Googling ooxml a:gs gets you the Datypic site that lists elements and attributes, but explains almost nothing about them. However, this site can be useful because all XML elements are hyperlinked, so you can quickly find related parameters.
Further down the page is the openofficexml.com page on a:gs. This site has relatively verbose explanations of the element, a clear example of useage and definitions of the elements included in the xml object.
Finally, many searches will turn up links to the Microsoft MSDN developer pages about Open Office XML. These discuss Themes and XML in a more conversational style that is great for picking up the overall concepts. Occasionally, you’ll also find a valuable blog post, such as Lars Corneliussen’s explanation of Open Office measurements units.
Graduated Color Rules
But back to graduated color table borders! First, let’s look at a graduated color rule, which you can create using the program interface. Here is the dialog box showing the settings. The central point of the gradient has been shifted to the left to have more solid color on the right side and a rapid dropoff to white on the left:
Here’s how the rule looks:
When we examine the XML for this rule, it looks like this:
The pos (position) parameter is a percentage of rule length, with 100000 representing 100 percent. The colors are straightforward, with bg1 being the white background and accent1 the cyan. For the midway color value, I used the handy RGB Tint Calculator on this site, but then moved that value to the 25% mark.
Graduated Color Table Borders
The XML for a rule translates exactly to the XML for a table style. Here is the style for the top border, the same XML is applied to the inside border so that all interior rows show the same rule: