Skip to content

Commit

Permalink
Merge pull request #20 from ctxis/master
Browse files Browse the repository at this point in the history
Add support for inserting page breaks
  • Loading branch information
orf authored Mar 25, 2019
2 parents 5df6448 + a367a31 commit c18039a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.1.3

Add support for inserting page breaks

## 1.1.2
Fix hyperlinks/styles/code sections inside textboxes

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
3 changes: 2 additions & 1 deletion wordinserter/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,8 @@ class Format(Operation):
"border",
"display",
"padding",
"line_height"
"line_height",
"page_break_after"
}

FORMAT_ALIASES = {
Expand Down
4 changes: 3 additions & 1 deletion wordinserter/renderers/com.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c18039a

Please sign in to comment.