Manuscript80
Manuscript80

Reputation: 23

Why isn't this OOXML text bold?

I'm looking at an OOXML WordprocessingML document that has bold enabled in the paragraph style, but no indication in the run level style. No other linked styles make any indications about bold status. I expected that inheritance would dictate the text to be bold, but when I view it in Mac Word 2016 the text ("Trailing Text") is unbolded. Why is that?

Here's the example:

<w:p>
    <w:pPr>
        <w:pStyle w:val="InconsequentialStyle"/>
        <w:jc w:val="both"/>
        <w:rPr>
            <w:b/>
            <w:color w:val="000000" w:themeColor="text1"/>
            <w:sz w:val="28"/>
        </w:rPr>
    </w:pPr>
    <w:r>
        <w:rPr>
            <w:b/>
            <w:color w:val="000000" w:themeColor="text1"/>
            <w:sz w:val="28"/>
        </w:rPr>
        <w:t xml:space="preserve">Leading text: </w:t>
    </w:r>
    <w:r>
        <w:rPr>
            <w:color w:val="000000" w:themeColor="text1"/>
            <w:sz w:val="28"/>
        </w:rPr>
        <w:t xml:space="preserve">Trailing Text</w:t>
    </w:r>
</w:p>

The text in the first run ("Leading Text:") is bolded by Word, which is my expectation. Does the lack a <w:b/> element turn the style off? If so, then what's the point of allowing the tag in the paragraph's style? FWIW, Word's formatting does appear to be the formatting preference of the document's author. I just can't figure out why this code is producing the desired effect.

If it helps, this text is not in a table, list or anything else. This <w:p> is a child of <w:body> and <w:docDefaults> doesn't specify anything about bold.

I'm seeing the same behavior with the <w:color> style in a different paragraph, so it's not just toggle styles. Please help me understand how Word is interpreting this code.

Upvotes: 1

Views: 885

Answers (1)

Dirk Vollmar
Dirk Vollmar

Reputation: 176169

If you want to apply direct formatting to a run of text you have to specify that formatting in the run properties of that run – and not in the run properties of the paragraph. That means the behavior you see is correct application behavior.

The run properties of the paragraph are used to format the paragraph marker. This formatting is used in Word to format list numbers and bullets:

enter image description here

Upvotes: 1

Related Questions