Closed rvskrishnaprasad closed 3 years ago
Hi, please provide the client (Word, PowerPoint, Excel, etc.), exact steps to repro, and files needed to repro. Then I can assign someone to follow-up. This Issue needs more details for us to take action. Thanks!
Hi, we are facing this issue in Word, Excel and PowerPoint. Here are the steps to re-produce.
Please refer below screenshot
Hi @rvskrishnaprasad Thanks for providing the repro steps. I assigned this to our Word/PPT/XL PMs to address.
Hi there, sorry for the delay. In Excel, you can use this to configure a shared runtime: https://docs.microsoft.com/en-us/office/dev/add-ins/develop/configure-your-add-in-to-use-a-shared-runtime.
You can then configure your add-in to handle open/close events: https://docs.microsoft.com/en-us/office/dev/add-ins/develop/show-hide-add-in
Note: it is currently only available in Excel. It is available on PowerPoint in Preview, and not yet available in Word (but is the plan to add support for all hosts).
What I'm trying to achieve is giving a prompt to user when user trying to close the task pane.
Hey @keyur32, I tried with above options, Excel taskpane is running in the background. But I couldn't capture the event when I'm trying to close my taskpane.
Office.addin.onVisibilityModeChanged().then(function (args) { if (args.visibilityMode = "Taskpane") { console.log('test', args.visibilityMode); // Code that runs whenever the task pane is made visible. } else if (args.visibilityMode === "Hidden") { // Show prompt to the user. } });
I'm trying something like this in Excel plugin, I expected that the close event should trigger the visibility mode hidden condition it should prompt the user, but the event itself is not reaching to else when im closing the taskpane.
Can you please suggest on this ??
Hi! At the date of this comment, Office.addin.onVisibilityModeChanged() doesn't work for Office.js Powerpoint. You could use Page Visibility API.
document.addEventListener("visibilitychange", function() {
if (document.hidden) {
console.log("The page is now hidden");
} else {
console.log("The page is now visible");
}
});
Expected Behavior
Able to handle Window closing event.
Current Behavior
We are unable to handle Window closing event in our application. Is there a way we can handle the event?