altandogan
altandogan

Reputation: 1285

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 ?

Upvotes: 0

Views: 2078

Answers (2)

altandogan
altandogan

Reputation: 1285

i solved this problem to use below solution.

enter image description here

Upvotes: 0

RyanCJI
RyanCJI

Reputation: 464

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.

Upvotes: 3

Related Questions