I programatically generate a document using docx4j.
I set the following document defaults when generating the document.
- Code: Select all
Styles styles = dleReportMLPackage.getMainDocumentPart().getStyleDefinitionsPart().getJaxbElement();
DocDefaults docDefaults = styles.getDocDefaults();
RFonts defaultRPrRFonts = docDefaults.getRPrDefault().getRPr().getRFonts();
defaultRPrRFonts.setAscii(TIMES_NEW_ROMAN);
defaultRPrRFonts.setHAnsi(TIMES_NEW_ROMAN);
defaultRPrRFonts.setCs(TIMES_NEW_ROMAN);
I then run the sample ConvertToPDF code to convert the document, I get no errors.
public boolean convert(WordprocessingMLPackage wMLP) throws Docx4JException {
// Font regex (optional)
// Set regex if you want to restrict to some ...