Turn from [http://blog.csdn.net/bodybo/article/details/43191319]
The program needs to read the Exel file with the following code snippet
[CSharp]View Plaincopy
- object omissing = System.Reflection.Missing.Value;
- Microsoft.Office.Interop.Excel.Application excelapp = new Microsoft.Office.Interop.Excel.Application ();
- Excelapp.usercontrol = true;
- Excelapp.displayalerts = false;
- ExcelApp.Application.Workbooks.Open (strFilePath, omissing, omissing, omissing, omissing, omissing, omissing, omissing , omissing, omissing, omissing, omissing, omissing, omissing, omissing);
- Workbook Workbook = excelapp.workbooks[1];
- Worksheet Worksheet = (Worksheet) workbook.worksheets[1];
The following sentence precedes the. net2.0. net4.0 error CS1969: One or more types required to compile the dynamic expression cannot be found. Is the reference missing?
[CSharp]View Plaincopy
- Worksheet Worksheet = (Worksheet) workbook.worksheets[1];
Solution: Modify the properties of the reference (Microsoft.Office.Interop.Excel) "Embed Interop Type" from True to False
C # calls the Excel report error CS1969: One or more types required to compile the dynamic expression cannot be found. Is the reference missing?