We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Show/Hide Functionality of particular sections

Is there any functionality or work around available so that with certain variable I can control certain sections of a doc. Basically show/hide based on that boolean.


If you can see my docx I have different sections like

COMPANY_ADDRESS_SECTION_WINDOWED that I want those sections(Not docx sections, our own logical sections) to be controlled by individual variable or so. I want those parts to be controlled somehow.

Is there any feature available? or Any mechanism.?

Hi Abhradeep,


Thanks for your inquiry. I think, you can wrap content in an IF field and based off a condition you can hide the content in the output. I have attached a modified document here for your reference. The following code demonstrates how to pass a value to bookmark:
Document doc = new Document(getMyDir() + “NewAiry-modified.docx”);

Bookmark condition = doc.getRange().getBookmarks().get(“condition”);
condition.setText(“0”);

doc.updateFields();

doc.save(getMyDir() + “out.docx”);

I hope, this helps.

Best regards,