如何在Office.js中为Excel添加插件添加对话框

时间:2019-12-10 18:13:29

标签: office365 office-js office-addins excel-addins

当用户单击任务窗格中的按钮时,应在excel本身中打开一个新对话框,将其重定向到特定链接。我尝试了很多次,但没有看到结果或错误。让我知道我应该编辑哪些文件。

示例: https://github.com/OfficeDev/office-js-docs-pr/blob/master/docs/develop/dialog-api-in-office-add-ins.md

https://docs.microsoft.com/en-us/office/dev/add-ins/develop/dialog-api-in-office-add-ins

function openDialog() {
  Office.context.ui.displayDialogAsync(
    'https://localhost:3000/popup.html',
    {height: 45, width: 55},

    function (result) {
      dialog = result.value;
      dialog.addEventHandler(Office.EventType.DialogMessageReceived, 
        processMessage);
  }
);
}

function processMessage(arg) {
  document.getElementById("user-name").innerHTML = arg.message;
  dialog.close();
}

0 个答案:

没有答案