简体   繁体   English

在 Office 任务窗格和内容插件之间进行通信

[英]Communicate between Office taskpane and content addin

I am working on a taskpane addin and a content addin for Powerpoint.我正在为 Powerpoint 开发任务窗格插件和内容插件。 I want to have the possibility to manipulate the content of the content addin through the taskpane addin, eg pushing a button in the taskpane addin to change an image or other web content in the content addin on the selected slide.我希望有可能通过任务面板插件来操作内容插件的内容,例如按下任务面板插件中的按钮以更改所选幻灯片上内容插件中的图像或其他 web 内容。

I can host both addins within the same React project, but I don't have the possibility to communicate between them in powerpoint to my knowledge.我可以在同一个 React 项目中托管两个插件,但据我所知,我无法在 powerpoint 中在它们之间进行通信。

If the two add-ins are both hosted on the exact same domain, you could try using LocalStorage as a go-between.如果这两个加载项都托管在完全相同的域中,您可以尝试使用 LocalStorage 作为中间人。 Your task pane stores a signal in a specific key of LocalStorage.您的任务窗格将信号存储在 LocalStorage 的特定键中。 Your content add-in must be setup to periodically check that key for changes and then respond accordingly.您的内容加载项必须设置为定期检查该密钥的更改,然后做出相应的响应。 I haven't tried this, but it might work.我没有尝试过这个,但它可能会起作用。

This is a well-known and solved problem - you're looking for communication between windows or tabs.这是一个众所周知且已解决的问题 - 您正在寻找 windows 或选项卡之间的通信。

Check out here: Communication between tabs or windows在这里查看: 选项卡之间的通信或 windows

In your apps, at the initialization part, you have to register the event listener for storage.在您的应用程序中,在初始化部分,您必须注册事件侦听器以进行存储。

window.addEventListener('storage', () => {
  console.log('your local storage has changed');
});

and based on the received event payload, you can manipulate data.并且基于接收到的事件负载,您可以操作数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Office365外接程序-如何在外接程序Windows之间进行通信 - Office365 Addins - How to communicate between addin Windows 任务窗格中的 Office 插件切换 div(加载面板)不起作用 - Office Addin toggle div (loading panel) in taskpane not working 为什么没有UI的Office Addin命令在从taskpane发送相同命令时没有响应? - Why does my Office Addin command without UI not respond while the same command send from taskpane does? 从办公室 excel addin TaskPane 访问 manifest.xml 数据 - Access manifest.xml data from within the office excel addin TaskPane 如何在office[Word Powerpoint] web插件中获取选中的图片内容? - How to get selected image content in office[Word Powerpoint] web addin? 办公室网站字插件 - office web word Addin 如何在内容脚本和面板之间进行通信 - How to communicate between content script and the panel 在内容脚本和选项页面之间进行通信 - Communicate between content script and options page API WebExtensions,在浏览器和内容脚本之间进行通信 - API WebExtensions, communicate between browser and content script OWA和Outlook客户端之间不共享由Office-JS Outlook外接程序设置的CustomProperties - CustomProperties set by Office-JS Outlook addin not shared between OWA & Outlook client
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM