Python-docx: Is it possible to add a new run to paragraph in a specific place (not at the end)
I want to set a style to a corrected word in MS Word text. Since it's not possible to change text style inside a run, I want to insert a new run with new style into the existing paragraph... for p in document.paragraphs: for run in p.runs: if 'text' in run.text: new_run= Run() new_run.text='some new text' # insert this run into paragraph # smth like: p.insert(new_run) How to do it? p.add_run() adds run to the end of paragraph, doesn't it? Update The best would be to be able to clone run (and insert it after a certain run). This way we reproduce the original run's style attributes in the new