I want to create a docx file by using Apache POI.
I want to set background colour of a run (i.e. a word or some parts of a paragraph).
How can I do this?
Is in possible via Apache POI or not.
Thanks in advance
I want to create a docx file by using Apache POI.
I want to set background colour of a run (i.e. a word or some parts of a paragraph).
How can I do this?
Is in possible via Apache POI or not.
Thanks in advance
Word provides two possibilities for this. There are really background colors possible within runs. But there are also so called highlighting settings.
With
XWPF
both possibilities are only possible using the underlying objectsCTShd
andCTHighlight
. But whileCTShd
is shipped with the defaultpoi-ooxml-schemas-3.13-...jar
, for theCTHighlight
the fullyooxml-schemas-1.3.jar
is needed as mentioned in https://poi.apache.org/faq.html#faq-N10025.Example: