在客户端Web应用程序中,我想:
我希望用户能够获得流畅的体验,并通过连接到BeforeClose事件来检测他们何时完成excel,但我发现我无法在javascript/HTML中连接到Excel的事件.
function BeforeCloseEventHandler(cancel) {
// TODO: read values from spreadsheet
alert("Closing...");
}
function openExcel() {
var excel = new ActiveXObject("Excel.Application");
var workbook = excel.Workbooks.Add();
var worksheet = workbook.Worksheets(1);
worksheet.Cells(1, 1).Value = "First Cell";
worksheet.Cells(1, 2).Value = "Second Cell";
workbook.BeforeClose = BeforeCloseEventHandler; // THIS DOESN'T WORK
excel.Visible = true;
excel.UserControl = true;
}
Run Code Online (Sandbox Code Playgroud)
有没有人有什么建议?