OfficeRuntime.DisplayWebDialogOptions interface

提供显示选项和对话框可能执行的操作。

注解

API 集:CustomFunctionsRuntime 1.1

使用方

示例

const dialogUrl = "https://your-addin-domain.com/dialog.html";
const dialogOptions: OfficeRuntime.DisplayWebDialogOptions = {
  height: "50%",
  width: "50%",
  displayInIFrame: false,
  onMessage: function (message: string, dialog?: OfficeRuntime.Dialog) {
    dialog?.close();
    console.log("Dialog result: " + message);
  },
  onRuntimeError: function (error: Error, dialog?: OfficeRuntime.Dialog) {
    dialog?.close();
    console.log("Dialog error: " + error.message);
  },
}
OfficeRuntime.displayWebDialog(dialogUrl, dialogOptions);

属性

displayInIFrame

可选参数,用于确定对话框是显示为 false) (弹出窗口,还是在 IFrame (true) 中显示。 此设置仅适用于在 Excel Online 上运行的自定义函数。

height

将对话框的高度定义为当前显示百分比的可选参数。 例如,接受“50%”、“50”等字符串。

onClose

关闭对话框时运行的可选回调。

onMessage

对话框向其父级发送消息时运行的可选回调。

onRuntimeError

对话框发送错误时运行的可选回调。

width

将对话框宽度定义为窗口百分比的可选参数。 例如,接受“50%”、“50”等字符串。

属性详细信息

displayInIFrame

可选参数,用于确定对话框是显示为 false) (弹出窗口,还是在 IFrame (true) 中显示。 此设置仅适用于在 Excel Online 上运行的自定义函数。

displayInIFrame?: boolean;

属性值

boolean

注解

API 集:CustomFunctionsRuntime 1.1

height

将对话框的高度定义为当前显示百分比的可选参数。 例如,接受“50%”、“50”等字符串。

height?: string;

属性值

string

注解

API 集:CustomFunctionsRuntime 1.1

onClose

关闭对话框时运行的可选回调。

onClose?: () => void;

属性值

() => void

注解

API 集:CustomFunctionsRuntime 1.1

onMessage

对话框向其父级发送消息时运行的可选回调。

onMessage?: (message: string, dialog?: Dialog) => void;

属性值

(message: string, dialog?: OfficeRuntime.Dialog) => void

注解

API 集:CustomFunctionsRuntime 1.1

onRuntimeError

对话框发送错误时运行的可选回调。

onRuntimeError?: (error: Error, dialog?: Dialog) => void;

属性值

(error: Error, dialog?: OfficeRuntime.Dialog) => void

注解

API 集:CustomFunctionsRuntime 1.1

width

将对话框宽度定义为窗口百分比的可选参数。 例如,接受“50%”、“50”等字符串。

width?: string;

属性值

string

注解

API 集:CustomFunctionsRuntime 1.1