@dennysfredericci,
Thanks for sharing the detail. We have tested the scenario using latest version of Aspose.Words for Java 18.4 with following code example and have not found the shared issue. Please use Aspose.Words for Java 18.4. We have attached the output DOCX with this post for your kind reference. 18.4.zip (13.8 KB)
Document doc = new Document(MyDir + "input.docx");
doc.getMailMerge().setFieldMergingCallback(new MyFieldMergingCallback_175624());
doc.getMailMerge().execute(new String[] {"OV_ALG_tekst_afwijking"}, new String[] {"<font style=\"font-family:Arial;font-size:13px;\"><p>Some html value as an example...</p></font>"});
doc.save(MyDir + "18.4.docx", SaveFormat.DOCX);
public class MyFieldMergingCallback implements IFieldMergingCallback {
@Override
public void fieldMerging(final FieldMergingArgs args) throws Exception {
//HTML formatteren in mergefield
if (args.getFieldValue() != null)
{
// Insert the text for this merge field as HTML data, using DocumentBuilder.
DocumentBuilder builder = new DocumentBuilder(args.getDocument());
builder.moveToMergeField(args.getDocumentFieldName(), true, false);
builder.insertHtml(args.getFieldValue().toString(), true);
args.setText("");
}
}
@Override
public void imageFieldMerging(final ImageFieldMergingArgs imageFieldMergingArgs) throws Exception {
}
}