Skip to content

How to change the default font size in document #86

Open
@frenet

Description

@frenet

from docx import Document
from docx.enum.text import WD_ALIGN_PARAGRAPH
document = Document()
p=document.add_heading('GM_lag', 0)

p.add_run('bold').bold = True

p2=document.add_paragraph("content in a paragraph")
p2.alignment = WD_ALIGN_PARAGRAPH.RIGHT
document.save('c:\reg.docx')

The above python-docx code runs smoothly, but it still does not meet my requirement.
The default font size of a paragraph is 11 point, but I'd like change it to a more small font size, for I want to put many words in one page, and 9 points is very good for me, how can I change the default font size in creating document by python-docx?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions