Bookmark.PasteAsNestedTable Method

Definition

Pastes a cell or group of cells as a nested table into the Bookmark control.

public:
 void PasteAsNestedTable();
public void PasteAsNestedTable ();
abstract member PasteAsNestedTable : unit -> unit
Public Sub PasteAsNestedTable ()

Examples

The following code example adds a Bookmark control to the table in the document, then pastes the table to the third cell as a nested table. The code then selects the next table in the bookmark.

This example is for a document-level customization.

private void BookmarkTopLevelTables()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();
    Word.Table myTable = this.Tables.Add(this.Paragraphs[1].Range,
        3, 3, ref missing, ref missing);
    Microsoft.Office.Tools.Word.Bookmark bookmark1 =
        this.Controls.AddBookmark(myTable.Range,
        "bookmark1");
    myTable.Range.Copy();
    myTable.Range.Cells[3].Range.PasteAsNestedTable();
    int index = 1;
    bookmark1.TopLevelTables[index].Select();
}
Private Sub BookmarkTopLevelTables()

    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Dim myTable As Word.Table = Me.Tables.Add( _
        Me.Paragraphs(1).Range, 3, 3)

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

    myTable.Range.Copy()
    myTable.Range.Cells(3).Range.PasteAsNestedTable()
    Dim Index As Integer = 1
    Bookmark1.TopLevelTables(Index).Select()

End Sub

Remarks

You can use PasteAsNestedTable only if the Clipboard contains a cell or group of cells and the Bookmark control contains a cell or group of cells in the current document.

Calling this method might delete the Bookmark control.

Applies to