22

In my Microsoft Word 2010 document I have two paragraph styles: Normal and Subject. Subject has "Style based on" set to Normal (inherits from Normal). In Normal, I have configured a 12pt gap after each paragraph and Subject inherited this rule just fine.

Then I accidentally added a space-after-paragraph rule to Subject, too. This means that Subject no longer "inherits" its space-after-paragraph setting from Normal, meaning that if I change the setting on Normal, I will have to change it on Subject as well.

I'd like to remove the space-after-paragraph setting from Subject so that it once again inherits that value from Normal. Is this possible? If so, how?

I tried deleting the value (12pt), hitting OK, Enter but the setting just reverts to 12pt (overriding the value set in Normal). Short of re-creating the Subject style from scratch I don't know how to solve this.

Thanks

SealedSun
  • 2,179

4 Answers4

13

Turns out there is already an article about this very topic (down to the space-after property being used as an example) available on the word.mvps.org website.

The general idea is you need to use a VBA macro once to clear the formatting. Microsoft Word would benefit from such feature included in the GUI.

Dim oStyle As Style
Set oStyle = ActiveDocument.Styles("Subject")
oStyle.ParagraphFormat.SpaceAfter = oStyle.BaseStyle.ParagraphFormat.SpaceAfter
Adam
  • 7,669
8

This is an old question, but still valid, and the answers given so far are not very practical. A simple way to cancel a definition, that deviates from the "Style based on", is to define the property to be the same as in "Style based on". This will remove the definition completely, because it is then useless.

As an example (and a specific answer to the original question), if your style is based on Normal, check what is the Spacing-After value in Normal style. Then change (Styles->[your style]->Modify->Format->Paragraph) the Spacing-After value in your style to be the same as in Normal style. (As default, at least in Word 2019 this value seems to be 8 pt, so you have to write the number 8 instead of clicking down-up, that goes in steps of 6 pt). After that, the style specific Spacing-After definition disappears.

2

TL;DR: Edit the XML definition of the style.

Setting the value to the BaseStyle value is a one-time fix, not something that restores inheritance. The values are explicitly set to the values of the base style, BUT not to inherit.

Example: Char style C1 is based on the defaults of para style List Number 2. LN2 is based on Normal. Normal font is Calibri 11 pt black. Open C1 and you see its font & size are blank. Change to Arial 10 and it's now forever an explicit value. Run the macro and C1 is set back to Calibri 11 pt black - not blank (inherited)! Change LN2 and C1 stays Calibri 11 pt black - not LN2's font and size. I haz a sad.

From an XML perspective, style grrr has w:color set to green. Its base style has 11 pt text

<w:style w:type="character" w:customStyle="1" w:styleId="grrr">
    <w:name w:val="grrr"/>
    <w:basedOn w:val="DefaultParagraphFont"/>
    <w:uiPriority w:val="1"/>
    <w:qFormat/>
    <w:rsid w:val="009014C2"/>
    <w:rPr>
        <w:color w:val="00B050"/>
    </w:rPr>
</w:style>

Note w:sz is not defined.

After a manual change to 8 pts the XML appears as such: <w:sz w:val="16"/>

After use of the .BaseStyle macro above, it is explicitly set to 11 pts in the XML: <w:sz w:val="22"/>

That's not inheritance. That's explicit setting to the value of the base style.

Manual removal of <w:sz w:val="22"/> from the XML restored inheritance. And that is a ridiculous solution.

In the UI, we see the font size is 11 pts. That's the same value as the base style, and was set using the BaseStyle approach, but it's the same as manually setting it to 11. enter image description here

When I change the base style, text formatted using Asset Title doesn't change. There's no inheritance - it's just 11 pts.

After editing docname.docx\word\styles.xml (without linearizing!) to remove <w:sz w:val="22"/> we see inheritance has been restored - the font size control is empty, which is Word's way of telling us the value is inherited.

enter image description here

When I change the base style, text formatted using Asset Title changes. There's inheritance - it's 11 pts because its parent is 11 pts.

Neman
  • 390
  • 1
  • 2
  • 13
1

To avoid using VBScript, you can do it by creating a "fully empty style", and then inherit and modify the desired properties:

  1. Show the Home tab of the ribbon
  2. Display the styles panel, using the arrow on the bottom right of the styles toolbar
  3. Select a paragraph of the style you want to modify, and click "Clear All" from the styles panel
  4. Keep the paragraph selected, and right click on the style name on the panel an choose "modity style to match the selection" (perhaps there's a different wording. I'm using Word in another language )
  5. Right click and choose modifcy the style, to set the parent style to inherit from, and modify desired properties.
JotaBe
  • 179