Вопрос

we have a web service hosted on iis 6.0, it open a specify excel template file. And a macro "t.xla" should retrieve data from database after excel opened, ready for client to download. The issue is that the macro seems not run. The code is like following (i'm not in company now, so i just write pseudocode):

System.Diagnostics.ProcessStartInfo pStartInfo = new ProcessStartInfo(excelAppPath, excelTemplatePath);
//nomal window is in debug mode, createNoWindow will be used in product envirionment
pStartInfo.WindowStyle = ProcessWindowStyle.Nomal;

System.Diagnostics.Process process = new Process();
process.Start(pStartInfo);
log.Info("Excel Process was started");

when i running this code, 1)could see excel.exe was started from task manager. 2)excel.exe creates no window on the desktop, someone says it should be, because of the iis limited. 3)I'm sure that the macro "t.xla" hadn't run, because there is no log exist which should be written by macro.When i doubleclick any one of the excel template, logs will be found.

Now iis worker process is run in local SYSTEM account , and already Enable IIS Admin Service to interact with desktop. Also the directory which the template file and log file in could be written by everyone

Could anyone give me some advise? Thanks in advance.

Это было полезно?

Решение

You might want to use another account other than local system -- that way you can log in as that account and try the same thing to see if any dialogs or errors are popping up that might be preventing things from moving further along, such as macro security settings. Microsoft does not support running Excel in this manner, but that doesn't mean you can't get it work. Check out this article, it covers many more details to consider: http://support.microsoft.com/kb/257757

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top