Free Support Forum - aspose.com

Like suppress functionality in Crystal reports

Is it possible for a user designing the word template, to set-mark some section or block of text in this template, to appear or disappear with the certain condition?! The result would be that a block of text together with some merge fields, would not be visible on some condition.
Thanks
Erik

Yes, you can set specific text to mark the certain parts of the template and your application can remove them or leave them based on some condition when preparing output documents. The format of markings is totally up to you, as it will be your app job to find and analyze it.

Something like [Range A -->] ... [<--Range A].

If you want the text to remain in document but be invisible you can use the Font.Hidden property.

Is it what you meant?

There are several ways this can be done. Sometimes one is better than the other. In addition to the method suggested above:

In MS Word insert continuous section breaks around the fragment of text you want to later delete. In your code use doc.Sections[sectionIndex].Remove.

Another way is to insert a bookmark into the document and in your code use doc.Range.Bookmarks[bookmarkName].Remove.