Skip to content

Default styles in table header cells are changed when replacing #11

@markheckmann

Description

@markheckmann

Firstly, thanks for the great package! 🙌 🙌 🙌

I noted one issue in table headers: While everything works fine when replacing text in shapes, the formats in table headers get changed, when using the tables's default format. If the format in the header is set explicitly, however, it is preserved.

In the image below, the right side shows the template (attached), the left side after replacement. The "Default" cells use the default table format. In the "NonDefault" ones I set the text style explicity. Note that the style in all default header cells get changed from white to black text color.

tables.pptx

image
from python_pptx_text_replacer import TextReplacer

replacer = TextReplacer("tables.pptx", slides="", tables=True, charts=True, textframes=True)
replacer.replace_text(
    [
        ("Default1", "D1"),
        ("Default2", "D2"),
        ("NonDefault1", "ND1"),
        ("One", "Changed One"),
        ("Two", "Changed Two"),
        ("Three", "Changed Three"),
        ("Four", "Changed Four"),
        ("Five", "Changed Five"),
        ("Default4", "D4"),
        ("Default5", "D5"),
    ]
)
replacer.write_presentation_to_file("./tables_changed.pptx")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions