diff --git a/CHANGELOG.md b/CHANGELOG.md index f7a0692..da239b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.1.3 + +Add support for inserting page breaks + ## 1.1.2 Fix hyperlinks/styles/code sections inside textboxes diff --git a/setup.py b/setup.py index 23fc7f4..c3912cc 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ setup( name='wordinserter', - version='1.1.2', + version='1.1.3', packages=find_packages(), url='https://github.com/orf/wordinserter', license='MIT', diff --git a/wordinserter/operations.py b/wordinserter/operations.py index 2f23927..8211e09 100644 --- a/wordinserter/operations.py +++ b/wordinserter/operations.py @@ -282,7 +282,8 @@ class Format(Operation): "border", "display", "padding", - "line_height" + "line_height", + "page_break_after" } FORMAT_ALIASES = { diff --git a/wordinserter/renderers/com.py b/wordinserter/renderers/com.py index ca6774d..e7e079f 100644 --- a/wordinserter/renderers/com.py +++ b/wordinserter/renderers/com.py @@ -187,7 +187,9 @@ def text(self, op: Text): @renders(LineBreak) def linebreak(self, op: LineBreak): - if isinstance(op.parent, Paragraph) or isinstance(op.parent, Group) and op.parent.is_root_group: + if op.format.page_break_after == "always": + self.selection.InsertBreak(self.constants.wdPageBreak) + elif isinstance(op.parent, Paragraph) or isinstance(op.parent, Group) and op.parent.is_root_group: self.selection.TypeParagraph() @renders(Paragraph)