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

Free Support Forum - aspose.com

Table cell is lost after removing content control using Java

Hi @tahir.manzoor

  1. I am facing a problem when I remove contain control from the document my next text is misplaced automatically.
  2. After removing contain control my hidden field starts visibly in the output document.

My expected behavior is ->

  1. My next text will not be misplaced when I remove contain control field.
  2. My hidden field will not visible after removed contain control field.

Test.zip (60.9 KB)

Can u please help me to solve this problem.


Could you please share the name of content control that you want to delete? We have not found any hidden field in the document. Please also share some detail about hidden field along with expected output document. We will investigate the issue and provide you more information on it.

Please check the “P098_0 RMS MultiParty (2 External).docx” input file.The table border is hidden.
for your ref. i am adding the input file with visible the table border.And also my expected output file.
I can remove any one of the contain control as exm (Full Signature - Internal Signer 1).
and more then one contain control.

Test (2).zip (54.1 KB)


The output.docx and eapected_output.docx are same. As per my understanding, you want to remove the content of content control and keep the table’s cell.

Following code example shows how to remove the content of content control where its markup level is CELL.

else if (sdt.getSdtType() == SdtType.RICH_TEXT && sdt.getLevel() == MarkupLevel.CELL)
    String orgFieldKey = sdt.getTag();
    String segments[] = orgFieldKey.split(">");
    String finalField = segments[0].replace("<", "");
    Map<String, String> mapData = new LinkedHashMap<>();
    mapData.put("SB_SIGNATURE_EXTERNAL", "asgd");
    mapData.put("SB_NAME_EXTERNAL", "sd");
    if (mapData.containsKey(finalField))
        System.out.println("match:::" + finalField);
        Cell cell = (Cell)sdt.getChild(NodeType.CELL, 0, true);

This code snippet does not remove the content control itself. If you want to remove it also, please add following line at the end of if block.


Thanks @tahir.manzoor
It’s working fine.