-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
Hi, I want to create a new run object, so I follow the guide here: https://stackoverflow.com/questions/52740630/python-docx-is-it-possible-to-add-a-new-run-to-paragraph-in-a-specific-place-n
from docx.text.run import Run
from docx.oxml.text.run import CT_R
# ...
for run in p.runs:
if 'text' in run.text:
new_run_element = p._element._new_r()
run._element.addnext(new_run_element)
new_run = Run(new_run_element, run._parent)
# ---do things with new_run, e.g.---
new_run.text = 'Foobar'
new_run.bold = True
But when I ran the code, I got this error as follow: 'CT_R' object has no attribute '_new_r'
I am using python-docx version 1.2.0
Metadata
Metadata
Assignees
Labels
No labels