I am trying to access the word document context from a dialog, like so:
Office.context.document.setSelectedDataAsync("Hello World!",
function (asyncResult) {
var error = asyncResult.error;
if (asyncResult.status === Office.AsyncResultStatus.Failed){
write(error.name + ": " + error.message);
}
});
This does not work as setSelectedDataAsync is undefined.
In the documentation here https://dev.office.com/reference/add-ins/shared/officeui.displaydialogasync it says at the bottom under Design considerations "Do not use a dialog box to interact with a document. Use a task pane instead."
Is it not possible at all to access the complete word document context from a dialog or is it just a recommendation to not do it?
Ideally I would like to show the user a list of entries with a lot of details, from which the user then can select one and a document will be inserted into the document. Technically I could do this in a TaskPane, but there is limited space there. If possible at all I would really like to do it in a dialog (especially as I have a few other very similar requirements).
Any chance to interact with the word document in the same way as from as TaskPane?