Instead of using WordExtractor, you can read Range :
... HWPFDocument doc = new HWPFDocument(fis); Range r = doc.getRange(); ...
Range is the central class of this model. When you get a range, you can play more with the features of the texts and, for example, iterate over all CharacterRuns characters and check if it is italic (.isItalic ()) or change to Italic: (.setItalic (true)).
for(int i = 0; i<r.numCharacterRuns(); i++) { CharacterRun cr = r.getCharacterRun(i); cr.setItalic(true); ... } ... File fon = new File(yourFilePathOut); FileOutputStream fos = new FileOutputStream(fon); doc.write(fos); ...
This works if you use HWPF. Meanwhile, framing and working with the Paragraph concept is more convenient.
source share