Microsoft.Office.Interop.Excel.Sheets sheets = (Microsoft.Office.Interop.Excel.Sheets)excel.ActiveWorkbook.Sheets;sheets.Count
“System.Linq.ParallelEnumerable.Count<TSource>(System.Linq.ParallelQuery<TSource>, System.Func<TSource,bool>)”是一个“方法”,这在给定的上下文中无效sheets.Count()
“Microsoft.Office.Interop.Excel.Sheets”不包含“Count”的定义,并且找不到可接受类型为“Microsoft.Office.Interop.Excel.Sheets”的第一个参数的扩展方法“Count”(是否缺少 using 指令或程序集引用?)啥原因,
我要获得 excel 中有多少个sheet
“System.Linq.ParallelEnumerable.Count<TSource>(System.Linq.ParallelQuery<TSource>, System.Func<TSource,bool>)”是一个“方法”,这在给定的上下文中无效sheets.Count()
“Microsoft.Office.Interop.Excel.Sheets”不包含“Count”的定义,并且找不到可接受类型为“Microsoft.Office.Interop.Excel.Sheets”的第一个参数的扩展方法“Count”(是否缺少 using 指令或程序集引用?)啥原因,
我要获得 excel 中有多少个sheet
System.Reflection.Missing miss = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Excel.Application xlapp = new Microsoft.Office.Interop.Excel.Application();
xlapp.Visible = true;
Microsoft.Office.Interop.Excel.Workbooks mBooks = (Microsoft.Office.Interop.Excel.Workbooks)xlapp.Workbooks;
Microsoft.Office.Interop.Excel.Workbook mBook = (Microsoft.Office.Interop.Excel.Workbook)mBooks.Add(miss);
Microsoft.Office.Interop.Excel.Sheets sheets = mBook.Excel4MacroSheets;
int i = sheets.Count;我这么用的时候没错呀