-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
I am consuming a word doc as a template, then when a user downloads the document, certain fields in that document are populated with some user data. The problem is when I am trying to add character styling to specific runs within a paragraph:
para.add_run(some_value, style='black-char-style')
para.add_run(next_value, style='red-char-style')
I even tried to insert a paragraph before:
para.insert_paragraph_before(some_value, style='black-paragraph')
para.insert_paragraph_before(next_value, style='red-paragraph')
para.clear()
Another take:
para.insert_paragraph_before(some_value, style='black-paragraph')
para.clear # or para.text = ''
para.add_run(next_value, style='red-char-style')
The result is either all black text or all red text, depending on which is set first. This is similar to the open issue in regard to splitting runs. I wrote my own functions to handle parsing out the strings I'm looking to add as a run, and it does so successfully, but the issue comes in styling.
Any suggestions, remediations, or upcoming class-based/api functions that allow for multiple styles to be set within a paragraph or sentence?
Metadata
Metadata
Assignees
Labels
No labels