Setting pgNumType property in python-docx is without effect
问题 I'm trying to set page numbers in a word document using python-docx . I found an attribute pgNumType (pageNumberType), which I'm setting with this code: document = Document() section = document.add_section(WD_SECTION.CONTINUOUS) sections = document.sections sectPr = sections[0]._sectPr pgNumType = OxmlElement('w:pgNumType') pgNumType.set(qn('w:fmt'), 'decimal') pgNumType.set(qn('w:start'), '1') sectPr.append(pgNumType) This code does nothing, no page numbers are in the output document. I did