Skip to content

feature: Row.allow_break_across_pages #245

@AlbinoShadow

Description

@AlbinoShadow

I'll try to keep it sweet and simple... There is a variable, paragraph.paragraph_format.keep_together, when it's true it will keep the paragraph on a single page instead of splitting it if it's at the end of the page.

I tried using this in a table scenario and it didn't work, although Word has the capability. After comparing the document.xml between a document where a row can split pages and one that cannot, I found that it acts as a table row property instead of a paragraph property (cantSplit vs keepLines in XML).

I can't seem to find any info regarding this within python-docx so I may make my own docx function for it, but I've got very little XML knowledge so I'd like to avoid that.

References for @scanny if he sees this:

<w:tr w:rsidR="00137A85" w:rsidTr="005B6BA3">
        <w:trPr>
          <w:cantSplit/>
        </w:trPr>

That's the XML with the row not splitting pages and this is without:

<w:tr w:rsidR="00137A85">

Obvious difference is the fact there's no table row property section and also the initial table row definition is different. If I end up making my own XML edits for this I'll make sure to post them.

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