Free Support Forum - aspose.com

INCLUDETEXT IF bookmark value

Hello

I am trying to include a general signature block in all documents.
So in the master document I use INCLUDETEXT to include this common signature document.
This has a series of:
{ IF { SigType } = “A” “Some text and a signatire” }
{ IF { SigType } = “B” “Some other text and a different signature” }

In the master document I declare and set the bookmark value.
This works in word but it renders all the the INCLUDETEXT file and the result using aspose 18.8.

If I include the signature block directly in the master document I get the same result.
Which makes me think that the issue is with evaluating { IF { SigType } = “A”… }.
The call to the merge is buried in multiple layers of indirection but eventually it calls:

final Document template = new Document( new ByteArrayInputStream(bytes) );
template.getMailMerge().setCleanupOptions(MailMergeCleanupOptions.REMOVE_CONTAINING_FIELDS |
// MailMergeCleanupOptions.REMOVE_UNUSED_FIELDS |
MailMergeCleanupOptions.REMOVE_EMPTY_PARAGRAPHS);
template.getMailMerge().execute(customDataSource);

for (final int fieldCode : FieldRemover.FIELD_CODES_TO_REMOVE) {
template.accept(new FieldRemover(fieldCode));
}
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
template.save( outputStream, AsposeMediaType.getMediaType(inToContentType));

Looking at similar logs I think conditional IF and INCLUDETEXT are supported so I assume we are missing something somewhere?

@mleake ,

Thanks for your inquiry. To ensure a timely and accurate response, please ZIP and attach the following resources here for testing:

  • Your simplified input Word document(s)
  • Aspose.Words 18.8 generated output DOCX file showing the undesired behavior
  • Your expected DOCX Word document showing the correct output. You can create expected document by using Microsoft Word.
  • Please also create a standalone simple Java application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing. Please do not include Aspose.Words JAR files in it to reduce the file size.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.