你可以告诉我为什么我在工作表= workbook.Sheets [“Sheet1”]上收到此错误的原因; &安培; worksheet = workbook.ActiveSheet;
“不能将类型'对象'转换为'Microsoft.office.Interop.Excel._Worksheet'。显式转换存在(你是否错过了演员?)”
Microsoft.Office.Interop.Excel._Application app = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel._Workbook workbook = app.Workbooks.Add(Type.Missing);
Microsoft.Office.Interop.Excel._Worksheet worksheet = null;
app.Visible = true;
***worksheet = workbook.Sheets["Sheet1"];***
***worksheet = workbook.ActiveSheet;***
worksheet.Name = "Exported from gridview";