BuildingBlock with such Name does not exist in the document glossary

I am getting follwing error on executing the code belove

Error: BuildingBlock with such Name does not exist in the document glossary

			for(StructuredDocumentTag contentControl:contentControlCollection )
					String contentControlValue = "value";

Can you please help on this

I am trying to set value for content control


Have you tried the latest version of Aspose.Words for Java i.e. 19.6 on your end?

In case the problem still remains, please ZIP and upload your input Word document (you are getting this problem with) here for testing. We will then investigate the issue on our end and provide you more information.

I have attached (13.5 KB)


We tested the scenario and have managed to reproduce the same problem on our end. For the sake of correction, we have logged this problem in our issue tracking system. The ID of this issue is WORDSNET-18735. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.


It is to update you that we have completed the analysis of WORDSNET-18735 and it turned out to be an expected behavior. BuildingBlock with the name you set has to be present in the Document.GlossaryDocument otherwise InvalidOperationException will occur. Please read the summary for PlaceholderName property. So, we will close this issue as ‘Not a Bug’.


Thank you for your guidance.

Can you let me know how can i overwrite existing text on content control field using java.


You can build logic on the following code to get the desired output:

Document doc = new Document("E:\\temp\\in.docx");
DocumentBuilder builder = new DocumentBuilder(doc);

StructuredDocumentTag sdt = (StructuredDocumentTag) doc.getChildNodes(NodeType.STRUCTURED_DOCUMENT_TAG,
if (sdt.getSdtType() == SdtType.RICH_TEXT) {

    Paragraph para = new Paragraph(doc);

    builder.insertHyperlink("", "", false);