问题
I have been trying to change the font style of specific sentences in the docx file using Apache POI, (XWPF).
I am able to change the font style (ex.color,font family) of whole document using XWPFRun -> run.setColor(color)
but the problem is for some reaseon, it generates multiple run for a single sentence.
Example:
Sentence: This is the sentence that has multiple run.
Run >: This is the
Run >: sentence
Run >:that has mul
Run >:tiple run
Run >: .
So, if i try to find the sentence from the file and then set the color, it does not do since the there are multiple runs for 1 sentence.
Aim : I have a JSON file from where i take the sentences and only for those sentences the font style should be changing in the docx file.
any help would be appreciated.
Out of many code, I have foud this code https://stackoverflow.com/a/63913997/13267143 for reference since it is close to what i require to do.
来源:https://stackoverflow.com/questions/65246636/change-font-style-of-whole-sentence-in-docx