问题
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