Hi,
I have a word template with a couple of IF statements. The if statement still exists after I used Aspose word to merge data.
Are there any methods to remove the IF statement in the result document?
I have attached the output file.
Hi,
I have a word template with a couple of IF statements. The if statement still exists after I used Aspose word to merge data.
Are there any methods to remove the IF statement in the result document?
I have attached the output file.
Hi Gangying,
Thanks for your query. It would be great if you please share your source document for investigation purposes.
Please read following documentation link for your kind reference. Hope this helps you. Please let us know if you have any more queries.
http://www.aspose.com/docs/display/wordsnet/How+to++replace+fields+with+static+text
Hi Tahir,
Thank you for your email. I can remove all IF statement block if the condition is false. But I cannot remove the image which is inside the if statement. The imgae appears at the bottom of the document three times. I have attached the sample project. You need to include the Aspose.Total.lic file to make it work.
Thank you,
Gangying
Hi Gangying,
Thanks for your query. I have added following function in FieldsHelper class. Please find the modified class in attachment.
Public Overrides Function VisitShapeStart(ByVal
shape As Shape)
As VisitorAction
' Remove the run if it is between the FieldStart and FieldSeparator of the field being converted.
CheckDepthAndRemoveNode(shape)
Return VisitorAction.Continue
End Function
Please let us know if you have any more queries.
Hi Tahir,
I have used the file to test my test file. It shows the opposite way. The image appears on the false condition and hides on the true condition. I have attache doc file.
Thank you,
Gangying
Hi there,
Hi Adam,
It works. I have already used the RemoveEmptyParagraphs in my code to remove the redundant blank line. Can I use both RemoveEmptyParagraphs and RemoveContainingFields at the same time to remove the blank line and IF statements?
With document
.MailMerge.CleanupOptions = Reporting.MailMergeCleanupOptions.RemoveEmptyParagraphs
.MailMerge.Execute(GetMergeFieldData)
.UpdateFields()
.Save(strFileName, SaveFormat.Doc)
End With
Thank you,
Gangying
Hi Gangying,
Hi Adam, Tahir,
It solved my problem with all the comments by you and Tahir.
Thank you very much for your efforts.
Gangying
Hi Gangying,