本文為機器翻譯文章。如需檢視英文版,請選取 [原文] 核取方塊。您也可以將滑鼠指標移到文字上,即可在快顯視窗顯示英文原文。
譯文
原文

WorksheetBase.Copy 方法 (Object, Object)

 

將工作表複製到活頁簿中的另一個位置。

命名空間:   Microsoft.Office.Tools.Excel
組件:  Microsoft.Office.Tools.Excel.v4.0.Utilities (於 Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

public void Copy(
	object before,
	object after
)

參數

before
Type: System.Object

將在前面放置所複製工作表的工作表。 如果您指定 After,則無法指定 Before

after
Type: System.Object

將在後面放置所複製工作表的工作表。 如果您指定 Before,則無法指定 After

The new worksheet is a T:Microsoft.Office.Interop.Excel.Worksheet object and does not have the code or data binding capability that worksheet host items have.

If you do not specify either Before or After, Microsoft Office Excel creates a new workbook that contains the copied sheet.

For information on optional parameters, see Understanding Optional Parameters in COM Interop.

The following code example uses the M:Microsoft.Office.Tools.Excel.WorksheetBase.Copy(System.Object,System.Object) method to create copies of the current worksheet before Sheet1 and after Sheet3. The example uses the P:Microsoft.Office.Tools.Excel.WorksheetBase.InnerObject property to access the underlying T:Microsoft.Office.Interop.Excel.Worksheet for Sheet1 and Sheet3.

This example is for a document-level customization.

private void CopyWorksheet()
{
    // Copy this worksheet before Sheet1.
    this.Copy(Globals.Sheet1.InnerObject);

    // Copy this worksheet after Sheet3.
    this.Copy(Globals.Sheet3.InnerObject);
}
回到頁首
顯示: