vsto c# sheet copy复制

var  sourceSheet=wb.Worksheets["模板表"];
Worksheet addSheet = wb.Worksheets.Add();
//sheet拷贝完,激活的sheet拷贝的新表
sourceSheet.Copy(addSheet);
Worksheet activeSheet = workbook.ActiveSheet;
//给sheet改名
activeSheet.Name = priceName;

参考【btn_Save_Click_1】
 worksheet.Copy(worksheet);
                    Worksheet addSheet = worksheet.Previous;
                    addSheet.Name = hisName;
                    addSheet.Visible = XlSheetVisibility.xlSheetVeryHidden;
                    worksheet.Activate();

第二段方法好使不会有夺得sheet

你可能感兴趣的:(excel,c#,vsto,c#,开发语言)