OOXML Hacking: Vertical Bullet Alignment

Bad design decisions haunt our lives. One poor choice was Microsoft’s selection of the text baseline for vertical bullet alignment in PowerPoint. Bigger bullets move up, smaller bullets move down, without any control in the user interface. I’m sure you’ve seen this effect as you change bullet size relative to text:

Bad Vertical Bullet Alignment


Fixing Vertical Bullet Alignment with VBA

There are a couple of ways to fix this issue. One is to download and install this free Add-in by John Wilson of PowerPoint Alchemy: Bullets Move Up and Down. The VBA code behind this add-in looks something like this:

Sub fixBulletAlignment()
  Dim oDes As Design
  Dim oMast As Master
  Dim L As Long
  Dim oCust As CustomLayout
  Dim oshp As Shape
  For Each oDes In ActivePresentation.Designs
    For Each oCust In oDes.SlideMaster.CustomLayouts
      For Each oshp In oCust.Shapes
        If oshp.Type = msoPlaceholder Then
          Select Case oshp.PlaceholderFormat.Type
          Case Is = ppPlaceholderBody, ppPlaceholderVerticalBody, ppPlaceholderObject
            For L = 1 To oshp.TextFrame.TextRange.Paragraphs.Count
              With oshp.TextFrame.TextRange.Paragraphs(L).ParagraphFormat
                .BaseLineAlignment = ppBaselineAlignCenter
              End With
            Next L
          End Select
        End If
      Next oshp
    Next oCust
  Next oDes
  MsgBox "Masters and layouts fixed", vbInformation, "PowerPoint Alchemy"
End Sub

When this runs, it adds an over-ride to the text level definitions on each slide layout that has multi-level text (any layout containing a Content or Text placeholder).

<a:lstStyle>
  <a:lvl1pPr fontAlgn="ctr">
    <a:defRPr/>
  </a:lvl1pPr>
  <a:lvl2pPr fontAlgn="ctr">
    <a:defRPr/>
  </a:lvl2pPr>
  <a:lvl3pPr fontAlgn="ctr">
    <a:defRPr/>
  </a:lvl3pPr>
  <a:lvl4pPr fontAlgn="ctr">
    <a:defRPr/>
  </a:lvl4pPr>
  <a:lvl5pPr fontAlgn="ctr">
    <a:defRPr/>
  </a:lvl5pPr>
</a:lstStyle>

This is adequate for most purposes. With correctly aligned bullets, we now get this effect when we change the bullet size:

Good Vertical Bullet Alignment

There are a couple of downsides to the VBA approach:

  • You have to remember to apply it to each presentation or template.
  • If you add a new layout, or add a new text or content placeholder to an existing layout, you’ll have to re-run the macro.
  • Table text and text box text does not benefit, their bullets will still be wonky.

Fixing Vertical Bullet Alignment with XML Hacking

With XML hacking, we can fix this problem once and never have to think about it again. Start by unzipping a new blank template, then editing ppt\slideMasters\slideMaster1.xml. There are 3 sections to be edited: p:titleStyle (for all title placeholders), p:bodyStyle (for all text or content placeholders) and p:otherStyle (for table text).

The editing is the same for all sections: for each a:lvlXpPr section, where X is the level number, add fontAlgn=”ctr” to the definition. Here’s what it looks like before…

<a:lvl1pPr marL="0" indent="0" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1">

…and after editing:

<a:lvl1pPr fontAlgn="ctr" marL="0" indent="0" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1">

There are 19 level definitions in slideMaster1.xml to change. When you’re done that, open ppt\presentation.xml and make the same edit to the 9 levels of the p:defaultTextStyle section that controls formatting for text boxes and notes and handout pages.

When you’re done, rezip the XML files and rename the template blank.potx. Place it so it works as your default template, here’s an article from Steve Rindsberg with the details for each Office version. For PowerPoint 2016 and 2019 for Windows, follow the PowerPoint 2013 directions. For 2019 for Mac, use the Mac 2016 directions: Create your own default presentation.

Now that this is set in your default template, every new file created when PowerPoint opens will have the correct vertical bullet alignment. Please note that in PowerPoint for Windows, if you choose File>New>Blank Presentation, this autogenerates a new file that is not based on your default template. Such a file will have incorrect vertical bullet alignment.

2:21 pm

6 thoughts on “OOXML Hacking: Vertical Bullet Alignment

  1. Hi John,
    Many thanks for sharing your knowledge with this great collection of articles!
    There is a control in the user interface to adjust the baseline alignment. But you have to add an east asian language for editing in the PowerPoint options, no need to install or to put it in the first place. Then you get an additional tab in the Paragraph dialog: “Asian Typography”. Here you find a drop-down “Text alignment” (Auto, Top, Center, Baseline, Bottom), and also the annoying feature “Allow Latin text to wrap in the middle of a word…
    It’s not nice to put features affecting Latin text in options not available for “normal” users.
    Best,
    Gastone

  2. I tried this on an existing template, but it won’t open. “PP will try to repair”, and then “Cannot open”. Any suggestions?

    • That means there is an error in the XML that you entered. The most common problem I see is the use of curly or “smart” quotes instead of straight quotes. Try this technique first with just the first level of bodyStyle. Then, when you get it working, copy and paste to the other text levels.

      • Damn, you’re good! I just copy pasted, and it was indeed not-so-“smart” quotes. I need to get some new glasses. Thank you!

    • This site publishes unique content for design professionals. If there was an easier way to do it, we would publish it, as would hundreds of other sites. Brandwares is always available for hire to do the work that’s too complicated or time-consuming for you to get done.

Leave a Reply

*Required fields. Your email address will not be published.

Posting XML? To enter XML code, please replace all less than signs "<" with "&lt;" and greater than signs ">" with "&gt;". Otherwise, Wordpress will strip them out and you will see only a blank area where your code would have appeared.