简体   繁体   中英

Excel opening with c# gets error at server

i have a console app. at server computer. this console is listening every 5 minutes a one file which has got excell files. When one of them from this excel files is opening i get a error like this :

Office has detected a problem with this file. To help protect your computer this
 file cannot be opened.

i get this error this line,

xlWorkBook = xlApp.Workbooks.Open(directory, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);

i think this excel file will be destroyed but when i try this my local it works clearly What can i do for this situation ?

The file poses a security risk. See http://support.microsoft.com/kb/973736 . MS recommends moving the file to a trusted location on the server.

To remedy in code, take a look at C# Excel 2010 Workbook Open error .

i solved this problem to use below solution.

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM