Not able to read content controls which are not added by word add-ins

38 Views Asked by At

I am stuck in an issue where I am not able to react to information about other content controls that are already there on the document page. These content controls were not added using Office API's. How can I handle this case? Is there any one who has faced this similar issues?

Please see the code below that is being used below for your reference.

Word.run(function (context) {
            // Use the Word object model to access content controls
            var contentControls = context.document.contentControls;
        
            // Load the content controls collection
            contentControls.load();
        
            // Synchronize the context
            return context.sync()
                .then(function () {
                    // Get the count of content controls
                    var count = contentControls.items.length;
                    console.log("Content Control Count: " + count);
                });
        })
        .catch(function (error) {
            console.log("Error: " + JSON.stringify(error));
        });
        

The above code gets that data for the new content controls being added with office API's but is not able to provide a reference for other content controls that are not added with API's.

I need all the content controls added by any of the means so that I can manipulate its data and use it further in my code below.

0

There are 0 best solutions below