OOXML Hacking: Styled Text Boxes Complete

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:

<a:lvl1pPr marL="0" indent="0">
  <a:buNone/>
  <a:defRPr sz="1400"/>
</a:lvl1pPr>

The first tag, a:buNone, sets the level to not have a bullet, while a:defRPr sets the text size to 14 points.

Next, here’s an example that shows line spacing and tab settings:

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

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.

For an overview of all level definition parameters, this page covers them: Datypic page for List Level Text Style


Styled Text Boxes – The Easy Way

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:

<a:objectDefaults>
  <a:txDef>
    <a:spPr>
      <a:noFill/>
    </a:spPr>
    <a:bodyPr wrap="square" rtlCol="0">
      <a:spAutoFit/>
    </a:bodyPr>
    <a:lstStyle>
      <a:defPPr>
        <a:defRPr dirty="0" smtClean="0">
          <a:latin typeface="+mn-lt"/>
        </a:defRPr>
      </a:defPPr>
    </a:lstStyle>
  </a:txDef>
</a:objectDefaults>

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:

<a:lvl1pPr marL="0" indent="0">
  <a:buNone/>
  <a:defRPr sz="1400"/>
</a:lvl1pPr>

And here’s what it looks like after reapplying the theme font in the layout:

<a:lvl1pPr marL="0" indent="0">
  <a:buNone/>
  <a:defRPr sz="1400">
    <a:latin typeface="+mn-lt"/>
  </a:defRPr>
</a:lvl1pPr>

Styled Text Boxes = Instant Text Placeholders

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:

Text Placeholder compared to 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.

As always, I welcome your questions, feedback and suggestions. Contact me at production@brandwares.com. Keep hacking!

OOXML Hacking: Text Box Styles

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:

<a:lvl1pPr marL="0" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1">
  <a:defRPr sz="2400" kern="1200">
    <a:solidFill>
      <a:schemeClr val="tx1"/>
    </a:solidFill>
    <a:latin typeface="+mn-lt"/>
    <a:ea typeface="+mn-ea"/>
    <a:cs typeface="+mn-cs"/>
  </a:defRPr>
</a:lvl1pPr>

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:

  1. marL – Sets the left margin for that text level in EMUs. 914,400 EMUs equal 1 inch, while 360,000 EMUs equal 1 centimeter.
  2. 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.
  3. defTabSz – Default tab size, again in EMUs.
  4. rtl – Is the language right to left? 0 means no.
  5. 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.
  6. 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.
  7. 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.

Text box styles from the first line parameters

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 production@brandwares.com.

OOXML Hacking: Custom Picture Content Controls

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.

Default Picture Content Control

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:

<pic:spPr bwMode="auto">
  <a:xfrm>
    <a:off x="0" y="0"/>
    <a:ext cx="3222172" cy="4576355"/>
  </a:xfrm>
  <a:prstGeom prst="roundRect">
    <a:avLst>
      <a:gd name="adj" fmla="val 8594"/>
    </a:avLst>
  </a:prstGeom>
  <a:solidFill>
    <a:srgbClr val="FFFFFF">
      <a:shade val="85000"/>
    </a:srgbClr>
  </a:solidFill>
  <a:ln>
    <a:noFill/>
  </a:ln>
  <a:effectLst/>
</pic:spPr>

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:

  <a:solidFill>
    <a:srgbClr val="FFFFFF">
      <a:shade val="85000"/>
    </a:srgbClr>
  </a:solidFill>

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:

Custom Picture Content Controls

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 production@brandwares.com.

Multiple Color Themes, One Template – Best Practices

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:

Super Theme Color Variants
Super Theme Color Variants

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:

<a:extraClrSchemeLst>
</a:extraClrSchemeLst>

Then add a color scheme:

<a:extraClrSchemeLst>
  <a:extraClrScheme>
    <a:clrScheme name="Red-Tan Chart Colors">
      <a:dk1>
        <a:srgbClr val="000000"/>
      </a:dk1>
      <a:lt1>
        <a:srgbClr val="FFFFFF"/>
      </a:lt1>
      <a:dk2>
        <a:srgbClr val="082948"/>
      </a:dk2>
      <a:lt2>
        <a:srgbClr val="FAF9F9"/>
      </a:lt2>
      <a:accent1>
        <a:srgbClr val="C46158"/>
      </a:accent1>
      <a:accent2>
        <a:srgbClr val="E69779"/>
      </a:accent2>
      <a:accent3>
        <a:srgbClr val="699BC5"/>
      </a:accent3>
      <a:accent4>
        <a:srgbClr val="6E9C82"/>
      </a:accent4>
      <a:accent5>
        <a:srgbClr val="1F497D"/>
      </a:accent5>
      <a:accent6>
        <a:srgbClr val="4A8363"/>
      </a:accent6>
      <a:hlink>
        <a:srgbClr val="1F497D"/>
      </a:hlink>
      <a:folHlink>
        <a:srgbClr val="699BC5"/>
      </a:folHlink>
    </a:clrScheme>
  </a:extraClrScheme>
</a:extraClrSchemeLst>

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

Multiple Color Themes

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:

  1. In PowerPoint, choose View>Slide Master to view the masters.
  2. 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.)
  3. Select the new master, then choose Color>Customize Colors.
  4. 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:

Each master has its own color theme and slide layouts.
Multiple Master Color Themes

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 production@brandwares.com for assistance with your project.

OOXML Hacking: Locking Graphics

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.

Before trying this, please read my Introduction to XML Hacking. If you’re using OS X, it’s also important to read my notes about Editing XML in OS X.

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:

<p:pic>
  <p:nvPicPr>
    <p:cNvPr id="7" name="Picture 6"/>
    <p:cNvPicPr>
      <a:picLocks noChangeAspect="1"/>
    </p:cNvPicPr>
    <p:nvPr userDrawn="1"/>
  </p:nvPicPr>

To lock this, we can add just one small parameter (in bold):

<p:pic>
  <p:nvPicPr>
    <p:cNvPr id="7" name="Picture 6"/>
    <p:cNvPicPr>
      <a:picLocks noChangeAspect="1" noSelect="1"/>
    </p:cNvPicPr>
    <p:nvPr userDrawn="1"/>
  </p:nvPicPr>

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:

<p:pic>
  <p:nvPicPr>
    <p:cNvPr id="7" name="Picture 6"/>
    <p:cNvPicPr>
      <a:picLocks noChangeAspect="1" noMove="1" noResize="1" noRot="1"/>
    </p:cNvPicPr>
    <p:nvPr userDrawn="1"/>
  </p:nvPicPr>

Locking Graphics: Shapes

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:

<p:sp>
  <p:nvSpPr>
    <p:cNvPr id="9" name="Rectangle 8"/>
    <p:cNvSpPr/>
    <p:nvPr userDrawn="1"/>
  </nvSpPr>

Editing the p:cNvSpPr tag as shown below will make the shape unselectable:

<p:sp>
  <p:nvSpPr>
    <p:cNvPr id="9" name="Rectangle 8"/>
    <p:cNvSpPr>
      <a:spLocks noMove="1" noResize="1" noRot="1"/>
    </p:cNvSpPr>
    <p:nvPr userDrawn="1"/>
  </nvSpPr>

Locking Graphics: Lines

At the XML level, lines are referred to as Connectors rather than Shapes. The original XML will look like this:

<p:cxnSp>
  <p:nvCxnSpPr>
    <p:cNvPr id="8" name="Straight Connector 7"/>
    <p:cNvCxnSpPr/>
    <p:nvPr userDrawn="1"/>
  </nvCxnSpPr>

To lock this, edit the p:cNvCxnSpPr tag:

<p:cxnSp>
  <p:nvCxnSpPr>
    <p:cNvPr id="8" name="Straight Connector 7"/>
    <p:cNvCxnSpPr>
      <a:cxnSpLocks noMove="1" noResize="1" noRot="1"/>
    </p:cNvCxnSpPr>
    <p:nvPr userDrawn="1"/>
  </nvCxnSpPr>

Locking Graphics: Placeholders

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:

<p:sp>
  <p:nvSpPr>
    <p:cNvPr id="2" name="Title 1"/>
      <p:cNvSpPr>
    <a:spLocks noGrp="1"/>
  </p:cNvSpPr>

After we add parameters to prevent moving and resizing, the XML looks like this:

<p:sp>
  <p:nvSpPr>
    <p:cNvPr id="2" name="Title 1"/>
      <p:cNvSpPr>
    <a:spLocks noGrp="1" noMove="1" noResize="1"/>
  </p:cNvSpPr>

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:

<p:sp>
  <p:nvSpPr>
    <p:cNvPr id="2" name="Title 1"/>
      <p:cNvSpPr>
    <a:spLocks noGrp="1" noMove="1" noResize="1" noRot="1"/>
  </p:cNvSpPr>

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:

Locked Title Placeholder


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:

<p:sp>
  <p:nvSpPr>
    <p:cNvPr id="7" name="TextBox 6"/>
    <p:cNvSpPr txBox="1"/>
    <p:nvPr userDrawn="1"/>
  </p:nvSpPr>

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&gt> information between the two. The noTextEdit parameter should mean the text can’t be edited, and to a limited extent it does that. A single click on text box text does not put it in edit mode, as would normally happen. But if you double-click, you can still edit the text. So this parameter on its own is not enough to do the job, it will only provide a little discouragement.

<p:sp>
  <p:nvSpPr>
    <p:cNvPr id="7" name="TextBox 6"/>
    <p:cNvSpPr txBox="1">
      <a:spLocks noTextEdit="1"/>
    </p:cNvSpPr>
    <p:nvPr userDrawn="1"/>
  </p:nvSpPr>

Handy Trick: Grouping Tables with Other Shapes

Normally, you can’t group a table with other shapes in PowerPoint. That’s because tables include this markup by default:

<p:cNvGraphicFramePr>
  <a:graphicFrameLocks noGrp="1"/>
</p:cNvGraphicFramePr>

Change the 1 to a 0. Re-open the file in PowerPoint and group the table with other shapes. Easy!


Unlocking Graphics: Design Ideas

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:

<a:spLocks noGrp="1" noRot="1" noChangeAspect="1" noMove="1" noResize="1" noEditPoints="1" noAdjustHandles="1" noChangeArrowheads="1" noChangeShapeType="1" noTextEdit="1"/>

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:

<a:spLocks />

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:

<wp:cNvGraphicFramePr>
  <<a:graphicFrameLocks xmlns:a="http://schemas.
openxmlformats.org/drawingml/2006/main" noSelect="1" />
</wp:cNvGraphicFramePr>

This does not:

<pic:cNvPicPr>
  <<a:picLocks noSelect="1" />
</pic:cNvPicPr>

To lock a text box in Excel, expand:

<xdr:cNvSpPr txBox="1"/>

To:

<xdr:cNvSpPr txBox="1">
  <a:spLocks noSelect="1"/>
</xdr:cNvSpPr>

You can make the text in the box ineditable while still allowing it to be selected and moved:

<xdr:cNvSpPr txBox="1">
  <a:spLocks noTextEdit="1"/>
</xdr:cNvSpPr>

Locking Graphics: Gotchas and Exceptions

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 5.1.2.1.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 production@brandwares.com.

Outline Numbering Variations – Best Practices

In my last post, I translated the classic method of outline numbering for macOS. But Shauna Kelly’s original steps have an element of personal preference them. We can also get reliable results from outline numbering variations.

Unfortunately, Shauna passed away a few years ago. I’m glad her site is still kept running by volunteers. If you’re formatting for Windows, you should read her article first: How to create numbered headings or outline numbering in Word 2007 and Word 2010

I think one notable restriction of Shauna’s procedure is that she relies on the built-in Heading styles. Often a numbering scheme is required that has nothing to do with headings. Here’s how we can separate these concepts and create solid numbering using an arbitrary style set. This applies to both Windows and OS X versions of Word.


Outline Numbering Variation – Alternative Styles

In Shauna’s classic technique, the first step is to revise the built-in Headings 1 to 9 so that Heading 1 is independent of other styles, then all the subsequent headings inherit characteristics from Heading 1. We’ll reuse this basic concept for a different style set.

First create a style that will be the basis for the first level of your outline numbering. For a start, this style should be based on No Style (Word OSX: Format>Style>Modify>Style based on:>(no style) Word for Windows: Ctrl + Alt + Shift + S to open the Styles list>Click on Manage Styles button>Modify>Style based on:>(no style)). This style really only needs to include the font, font size, line spacing, space before and after the paragraph. Any indenting or number style will be handled later. For this article, let’s call it Number Style 1. There is one essential parameter you must set. In the Paragraph format for the style, you must set the Outline level to Level 1 (With the Modify Style dialog still open, click on Format>Paragraph>Outline level. This is the key to making this work!

Next, we’ll create the second style. Start by basing it on Number Style 1, then format whatever variation it might have, staying away from indentation or numbering. Outline numbered styles are often very similar, this style might be exactly the same as Number Style 1. However, in Format>Paragraph, Outline level must be set to Level 2. Are we picking up the pattern yet?

Each additional style in the outline numbered series must be:

  • based on the previous style, and
  • have an outline level that is one level down from the previous style.

As long as you can format a chain of styles following these principles, you should be able to get it to work with the technique on this page for OS X (replace the first section Outline Numbering in Word for OS X – The Classic Method with the procedure on this page) or Windows (replace section 3. Set up your Heading paragraph styles with this page’s technique instead.


Outline Numbering Variation – Nested Bullet Styles

You can create nested sets of bullet styles by following the same steps as above. 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. Nested bullet styles work like outline numbering for bullets, though they’re a new concept for most users.

Feel free to post constructive comments suggesting improvements, I’m always trying to make these articles better.

Nested Bullet List Dialog

Outline Numbering in Word for macOS – Best Practices

Unlike most of my articles, this one is not a piece of original research. Shauna Kelly wrote the definitive method for producing outline numbering in Word several years ago. Unlike most of what you’ll read about techniques for creating numbering in Word, Shauna’s procedures actually work reliably. Unfortunately, Ms. Kelly passed away several years ago, though her web site has been kept going by volunteers. You can read her original posts here: How to create numbered headings or outline numbering in Word 2007 and Word 2010. My contribution is to document the steps needed to produce outline numbering in Word for macOS.

The names of some commands are different, or they’re found in a different place. I’m sticking to the step-by-step approach. For an in-depth explanation of why the steps work, please consult Shauna’s original pages. These instructions are quite specific. Please don’t include any steps not on the list below, or you’re on your own for the results.

Shauna argued strongly for using the built-in heading styles Headings 1 through 9. There’s nothing wrong with this and it can save a few steps. Sometimes, however, I prefer to save heading styles for headings and create a separate set of styles for numbering. In this article, I’ll translate Shauna’s classic method. The next post shows some optional variations: Outline Numbering Variations. If this is to be the basis for future documents, you want to be making these changes in a template. If you do this in a document and don’t apply the changes to the source template, you’ll have to redo all these steps for the next document or copy the styles using Word’s Organizer (Tools>Templates and Add-ins>Organizer in Word for Mac). Whenever you copy outline numbered sequences, you need to copy the styles that are linked (Headings 1 to 9 in this example) plus the List style (Numberings in this case).


Outline Numbering in Word for macOS – The Classic Method

Setting up the Styles

  1. Choose Format>Style and select Heading 1. (If you’re not already using Heading 1 in your document, change the List: dropdown to All styles)
  2. Click on the Modify button.
  3. Change the Style based on: dropdown from Normal to (no style) at the top of the list, then click on OK. While the dialog is open, choose Format>Paragraph and set the Left indent to 0 and the Special indent to (none). If there is any indenting, these will be set later. If you had already formatted Heading 1, you may need to make some changes after detaching it from Normal.
  4. Select Heading 2, click on Modify and change Style based on: to Heading 1. OK out.
  5. Repeat step 3 for each built-in Heading style, for as many levels of outline numbering as you require. Each style should be based on the one before.

Opening the Right Dialog Box

  1. In the Paragraph section of the Home tab, choose Multilevel List>Define New List Style. Avoid starting from Numbered List, that is not reliable.
    Multilevel List>Define New List Style in Word 2011 and 2016
    Outline Numbering in Word for OS X - Multilevel List 2011 (left) + 2016 (right)
  2. In the Define New List Style dialog, give your style a plural name like Headings or Numberings, since this will apply to several styles.
  3. Click on the Format button and choose Numbering.
  4. Set the style name and click on Format>Numbering in Word 2011
    Name + Numbering in Word 2011
    Word 2016 for Mac:
    Name + Numbering in Word 2016
  5. Now the Bullets and Numbering dialog opens, an extra step that doesn’t happen in Word for Windows. If you need straightforward legal-style numbering, there is a preset shown in the window that can save you many of the steps in the routine outlined below. Click on the Customize button.
    Bullets and Numbering Customize Button

Link a Paragraph Style to a List Style

  1. Finally we get to the Customize Outline Numbered List dialog. Once this dialog is open, we will leave it open until all levels are set up. Start by clicking on the dialog expander button to see all the options (circled in red):
    Word 2011:
    Customize Outline Numbered List in Word 2011
    Word 2016 for Mac:
    Customize Outline Numbered List in Word 2016
  2. Start by selecting 1 in the Level list.
  3. Next, we attach the paragraph style to the list style. Select Heading 1 in the Link level to style dropdown:
    Word 2011:
    Attach Paragraph Style to List Style in Word 2011
    Word 2016 for Mac:
    Attach Paragraph Style to List Style in Word 2016
  4. Now set the numbering for the style. In the Number format: (Word 2011) or Enter formatting for number: (Word 2016/2019) field, delete any content displayed. If the first outline numbering level starts with text, like Chapter 1 or Section 1, type in the text and a space.
  5. Using the Number style: (Word 2011) or Number style for this level: (Word 2016/2019) dropdown, choose the number appearance. Outline Numbering in Word for OS X has a quirk: the Level 1 choice is already displayed, even if no number appears in the Enter formatting for number: box. Just click on the dropdown and re-select the Level 1 that already appears selected and Word will do the right thing. A number appears in the Number format: or Enter formatting for number: field.
  6. Add any punctuation or symbol that is to follow the number.
  7. Set the Number position and Text position. Both numbers are the distance from the left margin. Left alignment for numbers is most common, but Roman numerals can look better right-aligned, since their width varies more. Normally the tab and indent are set for the same amount. The tab controls the position of the first line and the indent all the lines in the paragraph after that.

Repetition for All Levels (Legal-style Numbering)

Doing the rest of the levels involves repetitive steps that get a little longer with each level. Here are the steps for level 2:

  1. Select 2 from the Level list.
  2. Choose Heading 2 from the Link level to style: dropdown.
  3. Delete the contents of Number Format: (Word 2011) or Enter formatting for number: (Word 2016/2019).
  4. Set Previous level number: (Word 2011) or Include level from: (Word 2016/2019) to Level 1.
  5. Type a period.
  6. Click on the Number style: (Word 2011) or Number style for this level: (Word 2016/2019) dropdown and choose 1,2,3, ….
  7. Set the Number position and Text position.

So far, so good. Now let’s do level 3:

  1. Select 3 from the Level list.
  2. Choose Heading 3 from the Link level to style: dropdown.
  3. Delete the contents of Number Format: or Enter formatting for number:.
  4. Set Previous level number: or Include level from: to Level 1.
  5. Type a period.
  6. Set Previous level number: or Include level from: to Level 2.
  7. Type a period.
  8. Click on the Number style: or Number style for this level: dropdown and choose 1,2,3, ….
  9. Set the Number position and Text position.

Steps for Level 4:

  1. Select 4 from the Level list.
  2. Choose Heading 4 from the Link level to style: dropdown.
  3. Delete the contents of Number Format: or Enter formatting for number:.
  4. Set Previous level number: or Include level from: to Level 1.
  5. Type a period.
  6. Set Previous level number: or Include level from: to Level 2.
  7. Type a period.
  8. Set Previous level number: or Include level from: to Level 3.
  9. Type a period.
  10. Click on the Number style: or Number style for this level: dropdown and choose 1,2,3, ….
  11. Set the Number position and Text position.

Are you seeing the pattern? Each additional level repeats the previous steps and adds 2 new steps. By the time you get to level 9, you’ll have set the previous level and typed a period 8 times before setting the last number!


Editing Outline Numbering in Word for OS X

Like every good designer, you’ll probably want to tweak these styles later. For paragraph styling, like the amount of space before or after, you can simply modify the paragraph parameters. That’s easy. But anything to do with the numbering or its positioning relative to the paragraph should be done in the Outline Numbering dialog. Unfortunately, both Word 2011 and 2016 have a completely non-intuitive method for getting a list style into editing mode.

  1. In the Quick Style Gallery, right-click on Heading 1 and choose Modify Style.
  2. Click on the Format button and choose Numbering. The Bullets and Numbering dialog opens to the List Styles tab, where you can’t Add, Modify or Delete anything: the buttons are permanently disabled. Serious bug!
    Word bug: the Plus, Minus and Modify buttons are permanently disabled.
    Outline Numbering in Word for macOS - Ineditable List Style
  3. Click on the Outline Numbered tab. None is highlighted, which is not helpful. Examine the tiles carefully, you have to choose the correct one. Since you have linked styles to levels, the tile you are looking for will show the first 3 of those style names, but then several other tiles will also show the heading names as well.
  4. Click on it the most likely suspect and see if the Reset button becomes enabled. That only happens with user-created list styles, so that’s an indication of the correct tile.
  5. Now click on the Customize button. This will only work if you are editing the outline numbering on the same installation of Word on which you originally created it. Open in a different installation or version and the Bullets and Numbering tiles do not show your custom list.
  6. Edit the numbering, then exit when you are finished. Instead of editing your named List Style, Word has created a new list style autonamed Current List1.

If you’re using a different installation of the program than what you created the list on, you can’t even use the Outline Numbered tab. All the tiles will display the stock numberings. Instead of editing your list style, you must start all over and get it right in one editing pass.


Outline Numbering in Word for OS X: The Customize Outline Numbered list Dialog

Here are the final results for an outline numbered style as created in Word 2011. These shots are from the same dialog, only the Level number has been changed.

Level 1 in 2011
Level 2 in 2011
Level 3 in 2011
Level 4 in 2011
Level 5 in 2011
Level 6 in 2011
Level 7 in 2011
Level 8 in 2011
Level 9 in 2011

You can use Brandwares’ expertise to set up your outline numbering. Contact me at production@brandwares.com for an estimate.

OOXML Hacking: Graduated Color Table Borders

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:

Graduated Color Rule Settings

Here’s how the rule looks:

Graduated Color Rule

When we examine the XML for this rule, it looks like this:

<a:ln w="19050">
  <a:gradFill>
    <a:gsLst>
      <a:gs pos="0">
        <a:schemeClr val="bg1"/>
      </a:gs>
      <a:gs pos="25000">
        <a:srgbClr val="B7E6FF"/>
      </a:gs>
      <a:gs pos="100000">
        <a:schemeClr val="accent1"/>
      </a:gs>
    </a:gsLst>
    <a:lin ang="0" scaled="0"/>
  </a:gradFill>
</a:ln>

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:

<a:top>
  <a:ln w="19050">
    <a:gradFill>
      <a:gsLst>
        <a:gs pos="0">
          <a:schemeClr val="bg1"/>
        </a:gs>
        <a:gs pos="25000">
          <a:srgbClr val="B7E6FF"/>
        </a:gs>
        <a:gs pos="100000">
          <a:schemeClr val="accent1"/>
        </a:gs>
      </a:gsLst>
      <a:lin ang="0" scaled="0"/>
    </a:gradFill>
  </a:ln>
</a:top>

Here’s what the final table rules look like with the table style applied:

Graduated color table borders

For more information on how to create table styles, please read XML Hacking: Custom Table Styles, XML Hacking: Table Styles Complete and XML Hacking: Default Table Text.

5 Word Formatting Mistakes – Best Practices

Word is found everywhere, but Word users with training are a scarce commodity. It’s a shame, because a little training can go a long way to get really nice results. This article will cover the most common formatting mistakes that Word users make. If you’re a designer, you could still benefit, I see plenty of these errors from design companies as well.


Formatting Mistake #1: Not making the Non-printing Characters Visible

Pretty View, formatting mistakes paradise

Pretty View

By default Word is set up to show “pretty” documents. Microsoft has decided that users want to see what the printed output will look like on-screen. So Word hides all the control characters that are vital for reliable formatting. Users can’t see the hidden formatting that they are inserting or deleting. Result: formatting mistakes! The only way you can provide professional documents for clients is by making these visible so you can deal with them. When you want to see the printed result, do a Print Preview. It’s fast and more accurate than the “pretty” screen display.

Useful View, showing formatting characters

Useful View

The exact steps for show the control characters is slightly different for each version of Word, so I’m not going to list them all here. To start in OS X, look for Word>Preferences>View, in Windows, choose File>Options>Display. Make all the non-printing or formatting characters visible. It’s also helpful to display Bookmarks, Object anchors and in Word 2010/2011 or earlier, Text Boundaries. In Windows, these last three are found on the Advanced tab of Options.

Now you can see Paragraph Marks, which hold the paragraph formatting for the text that precedes it. You can see the Section Breaks that hold all the header/footer, margins and page orientation information for the paragraphs preceding it. And you can see the Anchors for text boxes and floating pictures, which makes it much easier to anchor to a paragraph that is likely to stay on the same page.


Formatting Mistake #2: Creating New Pages with Multiple Carriage Returns

This is the classic hallmark of the Word user who has never taken a course or cracked a book. At the end of a topic, they’ll type enough carriage returns to get to the next page, then type a new heading. It looks perfectly fine on the original computer:

How it looks on your computer

How it looks on your computer.

But then it’s sent to a different computer with different fonts or a different printer. The heading that supposed to be at the top of a page either moves to the bottom of the preceding page, or moves down so it’s not at the top of the page anymore. It doesn’t matter much which one happens, because the formatting mistakes scream Amateur Hour:

Your formatting mistakes are clear to everyone but you.

How it looks on a different computer.

Text flow in Word depends heavily on the font being used and the printer that has been selected. If you move the document to a different computer, they might not have the same font. Even a change in the version of a font is enough to make the text break differently. As for the printer, Word fabricates pages on the fly by using the metrics of the selected printer. These metrics come from the printer driver. So if the user who receives the documents has a different printer, or even a different driver for the same printer, the pages will be laid out differently.

The knowledgeable Word worker will insert a Page Break (not a Section Break) at the end of a text block to create a new page:

Page break: How it looks on every computer.

Page break: How it looks on every computer.

A really clever user will create a heading style that includes the paragraph attribute Page break before, so that whenever the heading style is applied to text, it automatically pops to the top of a new page:

Heading Style using Page Break Before Setting

Heading Style using Page Break Before Setting


Formatting Mistake #3: Using Tabs to Arrange Data in a Grid or Table

Whenever you need to arrange comparative information in rows and columns, you’re creating tabular arrangement. It’s always a good idea to pause for a moment and really look at the kind of data you want to present, so that you can choose the best format for that. If you find yourself using tabs and spaces to create a grid of data, STOP.

Making formatting mistakes with tabs

Making a lame table with tabs and spaces.

Information in a grid is tabular data (from which the tab key takes its name), but tabular data should go in a table. That’s what they’re for! Tab keys are left over from typewriters, when there was no other way to create a data grid. Designers are also guilty of creating grids with tabs, because table tools are relative newcomers to page layout software.

Use a table to arrange tabular information.

Use a table to arrange tabular information.

Tables are also the only professional way to make forms, which brings us to our next common mistake:


Formatting Mistake #4: Using Typewriter Techniques to Make Forms

Word, especially Windows versions, is loaded with excellent form-creation tools. But you’d never know it from the forms I almost invariably see created in that program. The common approach is to type a text heading, then dozens of underscores to indicate where the form-filler is to enter their data. This could pass for forms that are printed out and filled with a a pencil. You know, like people used to do 50 years ago:

Typewriter-style Form, serious formatting mistakes

Typewriter-style Form

Open the Word “form” on your computer and try filling it in. As you type, the underscores remain, trailing after your text. Type a couple of line of text: the left side of the filled portion falls underneath the heading, not to its right. The professional term for this is “a dog’s breakfast”.

Formatting mistakes: The form falls apart when filled.

The form falls apart when filled.

For forms that are filled on a computer, you need a much more robust method. Create a table with a cell for the heading and a separate cell for the filled-in area. If the form will only be filled out on the computer, you don’t need any horizontal rules to guide your text. The computer does that for you. If the form is intended to be dual purpose computer or hand-filled, add a thin border to the bottom of the filled-in cell. No other border are necessary or desirable. All of a sudden you have a form that is neat before and after filling, easy to read, even, dare we say, good-looking!

Table Form

The right way to make a form: with a table.

Here’s a comparison of a table form and a typewriter-style form when filled with longer text:

Form Comparison - Spot the formatting mistakes

Inserting long text


Formatting Mistake #5: Local Formatting Instead of Styles

Another giveaway of the Word amateur is when you click on different types of text and heading, but the Style always says Normal. This means the creator of the document made no use of Styles. Perhaps they think they are saving time, but the opposite is true. Repurposing or updating an unstyled document takes almost as long as creating it in the first place. Plus, useful Word features like a Table of Contents or the Navigation Pane don’t work well without using styles.

Local formatting mistakes

Using local formatting to imitate true styles.

After taking just a few minutes to create some basic styles everything about document creation and revisions is much faster. Styles are a true productivity booster. If you’re not using them, either you are wasting a lot of time, or you’re making someone else fritter away hours of their work day. Styles ensure your documents have a consistent, professional appearance. Updating their appearance in the future takes only a few minutes. It’s what the pros do!

Styled Text: formatting mistakes avoided!

A Heading Style applied.

We’re Word professionals! Brandwares will create technically perfect templates and documents for your company. For bullet-proof files, contact me at production@brandwares.com.

OOXML Hacking: Document Repair

You have a crucial thesis or presentation that’s due in the morning, but when you try to open it, you get a message saying the file has an error. It may seem like the end of the road, but with a little XML hacking, you can repair your file in just a few minutes and be back to work. Document repair is something you can do yourself.

First, let’s look at different causes of file corruption. The number one cause is working on files while they are on temporary or removable media. A USB or flash drive is a convenient way to carry data. The common alternative is to keep your information in the Cloud. But both of these are hazardous if you’re editing files. Accidentally ejecting a USB stick or losing your Internet connection while a file is open in Office is a near-guarantee of corruption. This type of corruption is also disastrous, because the file contents are so thoroughly scrambled, there is no way to recover the data.

But there are also files that get scrambled by software and usually these are recoverable. We’ll use the same techniques covered in previous posts. Windows users should review XML Hacking: An Introduction, while OS X hackers need to follow these instructions: XML Hacking: Editing in OS X


Is the File Recoverable?

When opened in Office, unrecoverable files may give you errors like these:

Recover Text
Parts Missing

The first step is to rename a copy of the file with a .zip ending and expand it. An unrecoverable file (one scrambled by a USB or Cloud drive) will almost always raise an Zip error. Cut your losses, you’re not going to be able to fix this. As a second-best alternative, try opening the original damaged file in NotePad (on Windows) or Text Edit (OS X) to recover whatever text you can. You also might be able to extract some contents by opening in a different word processor, like Pages on a Mac.

By contrast, if you see the following messages, document repair is possible:

Illegal Character
XML Corruption Warning

You can see that the first 2 messages are generic, while the second 2 give a specific location for the error. This means the file is at least partially readable by the program.


Error-finding

There are quite a few document repair articles on the web that are worth reading for the variety of tools that people are using. I prefer a combination of a good text editor (NotePad++ on Windows, BBEdit on OS X), plus a modern browser like FireFox or Chrome. The text editor is where you do the editing, while the browser parses the XML and finds any errors.

You’ve already unzipped the document or presentation, now look for the XML portion that contains the error. Most of the time, with a Word file, document.xml will be the culprit. Open document.xml in the text editor and Prettify (NotePad++) or Tidy (BBEdit) it to make it readable. A raw document.xml file only has 2 lines, which is why the XML errors are invariably reported as being on line 2. Making the text readable also adds useful line numbers to error reports, making the errors much quicker to find. Now the file should look like this:

document.xml

Save document.xml, then open it in your choice of browser. This is how FireFox and Chrome show where the first error is:

Browsers View XML

As you can see, the report is a little more informative in FireFox. The error is a mismatched tag: a tag was opened but not closed. It expected to see the closing tag </mc:Fallback> and it tells you exactly where it thought that tag should be. The arrow points to the first character that is in error. The correct way to interpret this is that the expected end tag should be inserted immediately before the tag pointed to.


Document Repair Technique

Here’s what the error location looks like in the text editor:

Document Repair Error Location

Then here is what it looks like after inserting the closing tag (you can copy and paste directly from the browser window):

Step 1 Document Repair

Save document.xml in the text editor, then refresh the browser. The next error is shown:

Step 1 Result

Repeat the steps. Some files have only a couple of errors, others may have dozens. You’ll know when you’re done, because refreshing the browser will give you a different screen, displaying the XML instead of an error message:

Final Document Repair Result


Rebuild the File

Close the text editor and browser, then re-zip the folders and [Content_Types].xml, giving the zip file a new name and a file ending that matches the original. Open it to ensure it works. Office does not tolerate XML errors well and doesn’t give you clear error messages, so if the file doesn’t open, you missed something. In addition, Mac users have to use Terminal to zip and view files, as noted on the XML Hacking: Editing in OS X page.

Lots of people ask “How can I prevent this?”, but there isn’t a really good answer. If a file can be repaired, it’s almost always due to a program bug that writes malformed XML. In the Word file used for example, this is often when a placed graphic has no fallback information, which is supposed to help with graphic depiction in older file formats. It appears that the program omits the closing fallback tags when saving and you get the error. It’s not your fault, but Microsoft has not been able to find and eliminate this bug since the 2007 version.