Hi Aspose,
I’ve ran into difficulties trying to get certain fonts substituted when saving a document as docx.
Here is example code I’m using:
LoadOptions loadOptions = new LoadOptions();
loadOptions.setLoadFormat(LoadFormat.HTML);
Document testDoc = new Document(“file/location/test.xhtml”, loadOptions);
FontSettings.getDefaultInstance().setFontSubstitutes(“Not A Font”, “Comic Sans Pro”);
FontSettings.getDefaultInstance().setFontSubstitutes(“Symbol”, “Arial”);
testDoc.save("/tmp/test.docx");
Here is the test.xhtml file I’m loading from:
<?xml version='1.0' encoding='UTF-8' ?>
This is Courier
This is Symbol
This is Not A Font
Given that the fonts “Symbol” and “Not A Font” are not present in the file system these fonts are not substituted as expected when looking at the output, test.docx. However when saving the document as a pdf the font substitution works fine.