Skip to content

Custom margins change to default ones #542

Open

Description

@klalex

I set custom margins for page layout in a template. When I generate docx it changes to default one. What I've noticed is that it depends on content. When I remove some content it works properly. If add content back there is issue described.

I use this version:

docxtpl = "^0.17.0"

Activity

  1. cvas22 commented on Nov 25, 2026

    @cvas22

    @klalex I think this is it: when the paragraph that ends a section also holds a {%p %} tag, the section break gets removed with it, so the section takes the next section's margins. That's why it depends on the content. Fixed in docform, the maintained fork, in cvas22/docform#204. If it still happens with your template, an attachment on cvas22/docform#111 would help.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions