Share via


Bookmark.PasteExcelTable(Boolean, Boolean, Boolean) Method

Definition

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

public:
 void PasteExcelTable(bool LinkedToExcel, bool WordFormatting, bool RTF);
public void PasteExcelTable (bool LinkedToExcel, bool WordFormatting, bool RTF);
abstract member PasteExcelTable : bool * bool * bool -> unit
Public Sub PasteExcelTable (LinkedToExcel As Boolean, WordFormatting As Boolean, RTF As Boolean)

Parameters

LinkedToExcel
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
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
Boolean

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

Examples

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);
}
Private Sub BookmarkPasteExcelTable()

    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Dim Bookmark1 As Microsoft.Office.Tools.Word.Bookmark = _
        Me.Controls.AddBookmark(Me.Paragraphs(1).Range, "Bookmark1")

    Bookmark1.PasteExcelTable(True, False, True)

End Sub

Remarks

Calling this method might delete the Bookmark control.

Optional Parameters

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

Applies to