Stepan Yakovenko
Stepan Yakovenko

Reputation: 9206

How to identify font name for a run in .docx file?

I have a run:

<w:r w:rsidRPr="00A7650B">
                <w:rPr>
                    <w:b/>
                    <w:sz w:val="40"/>
                    <w:szCs w:val="40"/>
                    <w:lang w:val="en-US"/>
                </w:rPr>
                <w:t>This is a title</w:t>
            </w:r>

Default paragraph style is:

<w:style w:type="paragraph" w:default="1" w:styleId="Normal">
    <w:name w:val="Normal"/>
    <w:qFormat/>
</w:style>

This run appears with Calibri font name in msword. The only place where Calibri is present inside .docx is theme1.xml (a:theme/a:themeElements/a:fontScheme/a:minorFont/a:latin). It is theme "Office Theme" with fontScheme "Office".

  1. Is this a right place to search for the font name in this case?
  2. How can I identify this in code, that for this run I should use theme1.xml and theme name is 'Office Theme'? Please don't suggest to use OpenXML SDK, I have to do it myself.

Upvotes: 1

Views: 1450

Answers (1)

Stepan Yakovenko
Stepan Yakovenko

Reputation: 9206

In [Content_types].xml there is reference to theme1.xml:

 <Override 
  PartName="/word/theme/theme1.xml" 
  ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/>

Inside theme1.xml there is

        <a:minorFont>
            <a:latin typeface="Calibri"/>

its default font for regular text.

Upvotes: 1

Related Questions