I’m using Office.js to display a dialog in an Office add-in. I call the displayDialogAsync function like this:
Office.context.ui.displayDialogAsync(`https://localhost:3000/notification.htmlmessage=${message}&icon=${icon}`,{ height: 10, width: 10, displayInIframe: true },function (asyncResult) {
dialog = asyncResult.value;
dialog.addEventHandler(Office.EventType.DialogMessageReceived, processDialogAlertMessage);});
However, the dialog that appears takes up more space than I specified in the displayDialogAsync options. It looks like it occupies 20% of the parent window height and 50% of the parent window width, even though I set both height and width to 10.
Why is the dialog taking up more space than specified, and how can I fix this issue to make the dialog appear with the intended dimensions?
2
Answers
The height property defines the height of the dialog as a percentage of the current display. Defaults to 80%. But the 250px is the minimum height value.
The width property defines the width of the dialog as a percentage of the current display. Defaults to 80%. But the 150px is the minimum width value.
Because there is a security requirement of Office that the dialog must present the major part of the add-in’s URL in the title bar, minimum width option cannot be satisficed in your scenario.