Free Support Forum -

Microsoft Word Document Mail Merge with IF condition issue in Aspose.Words REST API


I am generating word document using cloud aspose api in salesforce . In a template I am having many if and else block so when any condition not satisfied that block is not displayed in generated document but it is adding few spaces in the document.

I have already passing parameter as “cleanup=ContainingFields,EmptyParagraphs,UnusedFields,UnusedRegions” but still it is adding blank space. I have created one sample template and also attaching generated document !!

Can anyone guide me on this ???

Thank you,

Hi Sonal,

Thanks for your inquiry. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSCLOUD-150. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Thanks for your reply. But we are stuck on production due to this issue !! Approximate when will this issue get resolved??

Thank in advanced,

Hi Sonal,

Thanks for your inquiry. Currently, your issue is pending for analysis and is in the queue. Once our product team completes the analysis of your issue, we will then be able to provide you an estimate.

Thanks for your patience and understanding.
Hi Sonal,

Thanks for your patience. It is to inform you that the issue which you are facing is actually not a bug in Aspose.Words. So, we have closed this issue (WORDSCLOUD-150) as 'Not a Bug'.

The empty paragraphs are the part of first IF result. The true part contains leading paragraph break. That is why output document contains two empty paragraphs. The IF field has following structure:

{ IF x = x "
" "else"}

Please modify the IF field in your template document as shown below. We have attached the modified document with this post for your kind reference.

{ IF x = x "text
text" "else"}

IF «xyz.firstName»= "first block" "first if block