Recently upgraded docx4j version from 2.8.0 to 3.2.1
Rich content needs to inserted in Word document.
Used :
- Code: Select all
wordMLPackage.getMainDocumentPart().getContent() .addAll(XHTMLImporter.convert(body, null, wordMLPackage));
since 'convert' method changed in latest version, what is the equivalent to get list of wmi objects?
Tried the following snippet:
- Code: Select all
// Run time value
String body ="<html><font face="Arial, Verdana"><span style="font-size: 13.3333330154419px;">Word template test</span></font></html>";
XHTMLImporter importer = new XHTMLImporterImpl(wordMLPackage);
wordMLPackage.getMainDocumentPart().getContent().addAll(importer.convert(body, null));
but formatting is not retained.
Appreciate help on this.
Thanks.