Skip to content

Function fix_tables resets tables configured in Libreoffice Writer #64

Done

Description

@cvas22

Copied from python-docx-template issue 472, opened by @Manesx on 2022-12-28.


This solved my problem:

parser = etree.XMLParser(recover=True)
tree = etree.fromstring(xml_src, parser=parser)
# tree = self.fix_tables(xml_src)

Activity

  1. added
    bug
    on Nov 9, 2026
  2. cvas22 commented on Nov 22, 2026

    @cvas22
    OwnerAuthor

    @Manesx could you attach a LibreOffice Writer template where fix_tables resets the table settings? Tables I build here keep their layout, so I'd like to see what LibreOffice writes differently.

  3. cvas22 commented on Nov 25, 2026

    @cvas22
    OwnerAuthor

    @Manesx I think I found it without the file. fix_tables counted the rows of nested tables as part of the outer table, so a table with another table inside got its columns rescaled even with no tags in it. LibreOffice templates often have that. Fixed in #206 so you shouldn't need to skip fix_tables anymore. It'll be in the next release, or try pip install git+https://github.com/cvas22/docform. If your tables still get reset, attach the template and I'll reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions