I wonder whether Sym
support is in docx4j in the way you expect.
I tried your code and got the same issue, but I must confess to not having investigated symbols before. As an experiment, I added a symbol using the relevant “Insert” menu command in Word 2010, and then checked the resulting OpenXML—it’s really quite different to the mark-up expected when inserting an Sym
element.
Rather than manipulating symbols, have you tried inserting the text directly instead? For example, this will insert a tick character (not sure if that’s what you’re after):
P p = factory.createP();
R r = factory.createR();
RPr rpr = factory.createRPr();
Text text = factory.createText();
RFonts rfonts = factory.createRFonts();
rfonts.setAscii("Wingdings");
rfonts.setCs("Wingdings");
rfonts.setHAnsi("Wingdings");
rpr.setRFonts(rfonts);
r.setRPr(rpr);
text.setValue("\uF0FC");
r.getContent().add(text);
p.getContent().add(r);
mainPart.getContent().add(p);