Skip to content

Getting the default font for a document #383

@JordanReiter

Description

@JordanReiter

Currently, in most cases if you attempt to determine the default font for a document, that is:

documents.styles['Normal'].font.name

Very often the returned value will be blank — even though the normal style will definitely have a font specified when the file is opened, and it is located here:

file.docx/styles.xml

<w:styles ...>
  <w:docDefaults>
    <w:rPrDefault>
      <w:rPr>
        <w:rFonts w:ascii="Times New Roman" w:eastAsia="Times New Roman" w:hAnsi="Times New Roman" w:cs="Times New Roman"/>
        <w:lang w:val="en-US" w:eastAsia="en-US" w:bidi="ar-SA"/>
       </w:rPr>
    </w:rPrDefault>
  </w:docDefaults>

In the same way that there are special attributes for getting and setting the various margins of a Section, it seems that it should be possible to add getters and setters to the Document object for the default font properties.

Not having a very comprehensive understanding of the underworkings of xmlalchemy I am uncertain what steps I would take to enable this feature. I would be happy to write up the functionality if you point me in the right direction.
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions