We have a product which supports on O365 windows and mac using office js. Now on the same product, we are going to support on O365 word online. During our work, we have found one discrepancy in O365 windows and word online. We have a document that has a word table inside a content control.
In word online, we can't retrieve content controls that are inside the word table, however, we can retrieving all content controls in O365 windows and mac desktop.
Following code snippet working properly in the O365 window and mac but not working in word online.
$("#run").click(() => tryCatch(run));
function run() {
return Word.run(function (context) {
var contentControls = context.document.contentControls
context.load(contentControls, "id,text,title,tag,placeholderText");
return context.sync().then(function () {
/*console.log('The selected text was "' + contentControls.items.length + '".');*/
contentControls.items.forEach((contentControl: Word.ContentControl) => {
console.log('The Content control id "' + contentControl.id + '".');
});
});
});
}
/** Default helper for invoking an action and handling errors. */
function tryCatch(callback) {
Promise.resolve()
.then(callback)
.catch(function (error) {
// Note: In a production add-in, you'd want to notify the user through your add-in's UI.
console.error(error);
});
}