Office.js - Excel js AddIn 复制到剪贴板

发布于 2025-01-18 01:05:46 字数 399 浏览 5 评论 0原文

我试图使用 copy-to-clipboard(https://github.com/sudodoki/copy-to-clipboard)。这个 npm 包内部使用 document.execCommand('copy') 命令将数据复制到剪贴板。我在 chrome 开发控制台中尝试了此操作,命令正常工作。这在 Excel Desktop 中有效,但在 Excel Web 中失败。我尝试了一些其他替代方法来复制数据,但它们在网络上失败了。这是一个已知的限制吗?或者有人可以帮助我如何在 Excel Web 命令中将数据复制到剪贴板吗?

I was trying to copy data to clipboard as part of custom tab ribbon commands in Excel using copy-to-clipboard(https://github.com/sudodoki/copy-to-clipboard). This npm package internally using document.execCommand(‘copy’) commands to copy data to clipboard. I tried this in chrome dev console and command is working. This was working in Excel Desktop but its failing in Excel Web. I tried few other alternatives to copy data but they are failing in web. Is this a known limitation or can someone help me how you can copy data to clipboard in Excel web commands ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

人间不值得 2025-01-25 01:05:46

正确的。 Officejs没有提供任何东西。您可以使用

当开发团队完成计划过程时,考虑了技术社区的功能请求。使用github标签:类型:产品功能请求 at https://aka.ms/ M365Dev-Suggestions

Correct. OfficeJS doesn't provide anything for that. You may sill use the Document.execCommand() API which includes "copy", "cut" and "paste". But it was deprecated and may not work in the web browsers any longer.

Feature requests on Tech Community are considered, when the dev team go through the planning process. Use the github label: Type: product feature request at https://aka.ms/M365dev-suggestions .

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文