Reputation: 2013
When I am adding foll. code but on server its showing error. Code -
object oMissing = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Excel.ApplicationClass xl = new Microsoft.Office.Interop.Excel.ApplicationClass();
Microsoft.Office.Interop.Excel.Workbook xlBook;
Microsoft.Office.Interop.Excel.Worksheet xlSheet;
xlBook = (Workbook)xl.Workbooks.Open(docPath, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing);
xlSheet = (Worksheet)xlBook.Worksheets.get_Item(1);
xlSheet.Name = "Sheet1";
xlBook.Save();
xl.Application.Workbooks.Close();
Error -
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified.
I have added reference of "Microsoft.Office.Interop.Excel" dll in webApplication. In local its working fine. Note : In server microsoft Office is not installed. Can any one solve this issue without any installation on server.
Upvotes: 2
Views: 8467
Reputation: 24403
You cannot use Microsoft.Office.Interop.Excel without installing excel. But you can use EPPlus instead on the server
Upvotes: 2