在Office JS(Excel)中是否有类似的工作簿关闭事件?

huangapple go评论97阅读模式
英文:

Is there a Workbook Closed or a similar event in Office JS (Excel)?

问题

我想在工作簿关闭之前清除数据验证。是否有一个工作簿关闭或在用户关闭Excel时触发的事件?

我尝试查看工作簿和Office对象,但没有看到可用于像在VSTO中那样使用的内容。

英文:

I want to clear out data validations before a workbook closes. Is there a Workbook Closed or an event that fires when a user closes out Excel?

I tried looking through the Workbook and Office object and didnt see anything available to use like in VSTO.

答案1

得分: 1

尝试使用仅适用于Excel的Office.BeforeDocumentCloseNotification接口。它代表一个模态通知对话框,当用户尝试关闭文档时可能会出现。文档不会关闭,直到用户响应为止。通知对话框将允许用户确认关闭文档的请求或取消关闭文档的请求。通过这种方式,您将在工作簿关闭时收到通知。

您可以在使用Excel JavaScript API处理事件页面上找到适用于Excel的可用列表。

请注意,您可以在Tech Community上发布或投票支持现有的功能请求,这些请求将在Office开发团队进行规划过程时考虑。

英文:

Try using the Office.BeforeDocumentCloseNotification interface which is available for Excel only. It represents a modal notification dialog that can appear when the user attempts to close a document. The document won't close until the user responds. The notification dialog will allow the user to confirm the request to close the document or cancel the request to close the document. Following that way you will be notified when the workbook is closed.

You can find the list of available for Excel on the Work with Events using the Excel JavaScript API page.

Note, you can post or vote for an existing feature request on Tech Community where they are considered when the Office dev team goes through the planning process.

huangapple
  • 本文由 发表于 2023年6月29日 01:01:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/76575304.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定