By some libraries like http://poi.apache.org , we could create word document with any text color, but for background or highlight of the te
We Only need to add these 3 lines to set the background color for Word documents by XWPF. We have to set these lines after declaring XWPFRun and it's text color:
CTShd cTShd = run.getCTR().addNewRPr().addNewShd(); cTShd.setVal(STShd.CLEAR); cTShd.setFill(hex_background_color);