ActiveX Legacy Code not displaying Excel Application window

对着背影说爱祢 提交于 2020-12-13 21:09:40

问题


I have the following legacy javascript code that runs ActiveX in an html report.

This code works and displays an Excel sheet on the user's screen filled up with data from my report.

//some initialisations here
var Excel, Book;
// Create the Excel application object.
Excel = new ActiveXObject("Excel.Application");
// Make Excel visible.
Excel.Visible = true;
// Create a new work book.
Book = Excel.Workbooks.Add();

//headers[] init here
for (var j = 0; j < colCount; j++) {
    //setting my report headers
    Book.ActiveSheet.Cells(1,j + 1).Value = headers[j];
}

// Place some text in the report
for (var i = 0; i <= rowCount-1; i++) {
    for (var j = 0; j <= colCount; j++) {
        Book.ActiveSheet.Cells(i+2,i + 1).Value = str;
    }
}

In most of the pcs tested this code works fine and displays the report in an Excel window.

The problem lies in a few pcs where the Excel application is created (can be seen in the task manager) but is not visible to the user.

The Pcs tested do use the same options in Internet Settings, are on the same network environment, and use same Antivirus and Office versions.

Does anyone have any suggestions that I could use in order to display the Excel window?

来源:https://stackoverflow.com/questions/65103877/activex-legacy-code-not-displaying-excel-application-window

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!