我有三个Excel工作表,我想在一个工作簿下合并。
答案 0 :(得分:2)
如果您需要在C#中执行此操作,请查看Merge Excel Files Into One以获取一些想法。
您将需要Microsoft Excel Interop库。我在http://forums.asp.net/p/1457463/3498328.aspx
找到了以下示例ApplicationClass excelApplicationClass = new ApplicationClass();
_Workbook finalWorkbook = null;
Workbook workBook = null;
Worksheet workSheet = null;
Worksheet newWorksheet = null;
// Open or create destination WorkBook
finalWorkbook = excelApplicationClass.Workbooks.Open("dest.xlsx", ...);
//Open the source WorkBook
workBook = excelApplicationClass.Workbooks.Open("src.xlsx", ...);
//Open the WorkSheet
workSheet = (Worksheet)workBook.Sheets[1];
int countWorkSheet = finalWorkbook.Worksheets.Count;
newWorksheet = (Worksheet)finalWorkbook.Sheets[countWorkSheet];
workSheet.Copy(Missing.Value, newWorksheet); //Copy from src to destn
finalWorkbook.Save();
workBook.Save();
搜索Excel.Workseet.Copy()方法。这应该让你沿着所需的代码路径前进。
祝你好运!答案 1 :(得分:0)
Move or Copy...
To book
下拉菜单中选择您要复制到的图书Create a copy
OK