Search code examples
ms-wordpython-docx

N page break object after running add_break method fails


I'm a having a problem with the python-docx library. I'm following this page's example however it doesn't seem to work. Can anyone provide some assistance?

>>> all_runs[0]
<docx.text.Run object at 0x7f49b899c5d0>
>>> play=all_runs[0]
>>> play.add_break(WD_BREAK.PAGE)
>>> play.breaks
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'Run' object has no attribute 'breaks'

Solution

  • That page is part of the design documentation, not as-built documentation (notice the title 'Candidate' protocol). There is no breaks property implemented on Run as yet.

    If you can say a bit about what you're trying to accomplish I may be able to help.