日期:2014-05-17  浏览次数:20891 次

急急急急急急急急急急急急急急急急!!!操作excel问题
我现在有一个excel里面有一个sheet,我想根据这个sheet作为模板往后复制新的sheet。具体多少个我会获得,希望高手可以解答如何动态的复制sheet表格

------解决方案--------------------
Excel.Application app = new Excel.ApplicationClass();
app.Visible = true;
Excel.Workbook workBook = app.Workbooks.Open(templetFile,missing,missing,missing,missing,missing,missing,missing,missing,missing,missing,missing,missing);
Excel.Worksheet workSheet = (Excel.Worksheet)workBook.Sheets.get_Item(1);
for(int i=1;i <sheetCount;i++)
{
((Excel.Worksheet)workBook.Worksheets.get_Item(i)).Copy(missing,workBook.Worksheets[i]);
 
}