共用方式為


Bookmark.Cells Property

Definition

Gets a Cells collection that represents the table cells in a Bookmark control.

public:
 property Microsoft::Office::Interop::Word::Cells ^ Cells { Microsoft::Office::Interop::Word::Cells ^ get(); };
public Microsoft.Office.Interop.Word.Cells Cells { get; }
member this.Cells : Microsoft.Office.Interop.Word.Cells
Public ReadOnly Property Cells As Cells

Property Value

A Cells collection that represents the table cells in a Bookmark control.

Examples

The following code example adds a three-column, three-row table to the document, then adds a Bookmark control to the table. Finally, the code changes the width of the table cells within the bookmark.

This example is for a document-level customization.

private void BookmarkCells()
{
    Word.Table myTable;

    this.Paragraphs[1].Range.InsertParagraphBefore();
    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");
    if (bookmark1.Tables.Count > 0)
    {
        bookmark1.Cells.Width = Application.InchesToPoints(1);
    }
}
Private Sub BookmarkCells()

    Dim myTable As Word.Table
    Me.Paragraphs(1).Range.InsertParagraphBefore()
    myTable = Me.Tables.Add(Me.Paragraphs(1).Range, 3, 3)
    Dim Bookmark1 As Microsoft.Office.Tools.Word.Bookmark = _
        Me.Controls.AddBookmark(myTable.Range, "Bookmark1")
    If Bookmark1.Tables.Count > 0 Then
        Bookmark1.Cells.Width = Application.InchesToPoints(1)
    End If

End Sub

Applies to