Expand Minimize

Bookmark.PasteExcelTable Method

Pastes and formats a Microsoft Office Excel table into the Bookmark control.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word (in Microsoft.Office.Tools.Word.dll)

void PasteExcelTable(
	bool LinkedToExcel,
	bool WordFormatting,
	bool RTF
)

Parameters

LinkedToExcel
Type: System.Boolean

true to link the pasted table to the original Excel file so that changes made to the Excel file are reflected in Microsoft Office Word.

WordFormatting
Type: System.Boolean

true to format the table using the formatting in the Word document. false to format the table according to the original Excel file.

RTF
Type: System.Boolean

true to paste the Excel table using Rich Text Format (RTF). false to paste the Excel table as HTML.

Calling this method might delete the Bookmark control.

Optional Parameters

For information on optional parameters, see Optional Parameters in Office Solutions.

The following code example pastes an Excel table into the Bookmark control. The parameters specify that the pasted table is linked to the Excel file, retains the original Excel formatting, and is pasted as RTF. This example requires that the Clipboard contains an Excel table.

This example is for a document-level customization.

private void BookmarkPasteExcelTable()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();
    Microsoft.Office.Tools.Word.Bookmark bookmark1 =
        this.Controls.AddBookmark(this.Paragraphs[1].Range,
        "bookmark1");

    bool LinkedToExcel = true;
    bool WordFormatting = false;
    bool RTF = true;

    bookmark1.PasteExcelTable(LinkedToExcel, WordFormatting, RTF);
}

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft