Unable to insert content controls on numbers within a shape.
Platform: PC desktop
Host: Word
Office version number: Microsoft® Word for Microsoft 365 MSO (Version 2404 Build 16.0.17531.20140) 64-bit
Operating System: Microsoft Windows 11 pro.
I'm unable to insert content controls on numbers within a shape. Is there a way to do this?
I'm attempting to search for numeric patterns (e.g., [0-9.,]{1,}) throughout the document, including inside tables or shapes.
const body = context.document.body;
const searchResults = body.search("[0-9]{1,}", { matchWildcards: true });
// Load the search results
context.load(searchResults, 'text');
await context.sync();
// Loop through the search results and add content controls
searchResults.items.forEach((item) => {
const contentControl = item.insertContentControl();
contentControl.title = "Number Control";
contentControl.tag = createGuid();
});
await context.sync();While this code successfully returns results for regular tables, it does not work for tables that are embedded within shapes.
Are there any specific properties, methods, or techniques that should be used to handle this scenario?
Expected Behavior:
The searchResults should return matches for numeric patterns within both regular tables and tables inside shapes.
Actual Behavior:
The searchResults return no matches for content inside tables embedded in a shape, even though numeric patterns are present in those tables.
Additional Information:
I have attached the Word document containing the specific table in shape format where the issue occurs for further investigation.