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

Free Support Forum - aspose.com

Content control is not unlocked after replacing its text using Java


We are not able to uncheck “Contents cannot be edited” option of Word Content Control Properties window AsposeSDT.PNG
through Aspose Java API.Please find below code snippet we have used in java to un-check that option.

final StructuredDocumentTag tag = new StructuredDocumentTag( document,
( ( targetContent.getContentType()
.equalsIgnoreCase( CCUConstants.IMAGE_CONTENTS ) ) ? SdtType.PICTURE
: SdtType.RICH_TEXT ),
MarkupLevel.INLINE );
tag.setTitle( targetContent.getElement().getContentType() + “:” + targetContent.getName() );
tag.setTag( “content:{“name”:”" + targetContent.getName() + “”,“uuid”:"" + targetContent.getUuid() + “”}" );
tag.setLockContents( false );
final FindReplaceOptions findReplaceOptions = new FindReplaceOptions();
findReplaceOptions.setFindWholeWordsOnly( true );
findReplaceOptions.setMatchCase( true );
tag.getRange().replace( “Click here to enter text”, targetContent.getName(), findReplaceOptions )


To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please attach the output Word file that shows the undesired behavior.
  • Please attach the expected output Word file that shows the desired behavior.
  • Please create a simple Java application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.