将元素值从任务窗格传递到 PowerPoint 对话框

问题描述 投票:0回答:0

我正在测试 PowerPoint 加载项并使用 Office API 来创建一些功能。其中之一是从用户那里获取输入(在 textarea 标签中),单击打开对话框的按钮,并将输入显示为框中的文本。

我在文本区域附加了一个 ID('tarea'):

<textarea id="tarea" rows="2" cols="40"></textarea>

..和按钮:

<button id="odi" class="ms-Button ms-Button--primary">
  <span class="ms-Button-label">Open Dialog</span>
</button>

..可以读取值:

const query = document.getElementById('tarea').value

..并按下按钮打开对话框,该按钮指向

id=odi

await Office.context.ui.displayDialogAsync('https://localhost:3000/test.html', {
    height: 70,
    width: 80,
    displayInIframe: true, 
}); 

按下按钮后如何捕获查询的值并将其显示在对话框中?文本区域和按钮位于 taskpane 文件夹中,但对话框引用了另一个文件夹 test,其中显示了 test.html 的内容。因此,理想情况下,我在文本区域中输入一个查询,按下一个按钮,清除文本区域,然后会显示一个显示该查询的对话框。

javascript html powerpoint office-js office-addins
© www.soinside.com 2019 - 2024. All rights reserved.