0
我有三個我想在一個工作簿下合併的Excel工作表。如何在一個工作簿下放置三個Excel工作表
我有三個我想在一個工作簿下合併的Excel工作表。如何在一個工作簿下放置三個Excel工作表
Move or Copy...
To book
下拉第一板的名稱,然後單擊鼠標右鍵選擇要複製的書到Create a copy
OK
如果你需要做這在C#,看看Merge Excel Files Into One的一些想法。
您將需要Microsoft Excel互操作庫。我發現下面的例子在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()方法的搜索。這應該讓你走下所需的代碼路徑。
祝你好運!
我想在c#中爲此編寫一個程序。我不想手動做。 – happysmile 2010-08-10 06:46:09