Skip to content

Tutorial bug - "Header" style already exists #597

@skrupenin1

Description

@skrupenin1

I get an error when following the 2.6.3 Adding “zoned” header content section of the latest (0.8.9) tutorial with the 0.8.10 release. The error is "ValueError: document already contains style 'Header'". Steps to reproduce:

from docx import Document
from docx.enum.style import WD_STYLE_TYPE
document = Document()
styles = document.styles
style = styles.add_style("Header", WD_STYLE_TYPE.PARAGRAPH)

Apparently, the default docx template now contains a header style, where it did not previously.

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