2010-08-10 68 views

回答

0
  1. 打開所有工作簿的一次
  2. 上要複製並選擇Move or Copy...
  3. To book下拉第一板的名稱,然後單擊鼠標右鍵選擇要複製的書到
  4. 蜱,說Create a copy
  5. OK
  6. 重複步驟2-5對其他2片箱
+0

我想在c#中爲此編寫一個程序。我不想手動做。 – happysmile 2010-08-10 06:46:09

2

如果你需要做這在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()方法的搜索。這應該讓你走下所需的代碼路徑。

祝你好運!

相關問題