Export (0) Print
Expand All
Expand Minimize

How to: Add Text and Formatting to Cells in Word Tables


Some code examples in this topic use the this or Me keyword or the Globals class in a way that is specific to document-level customizations, or they rely on features of document-level customizations such as host controls. These examples can be compiled only if you have the required applications installed. For more information, see Features Available by Product Combination.

Each table consists of a collection of cells, with each individual Cell object representing one cell in the table. You refer to each cell by its location in the table. This example refers to the cell located in the first row and the first column of the table, adding text, and applying formatting.

To add text and formatting to cells

  • Refer to the cell by its location in the table, add text to the cell and apply the formatting.

    Word.Cell cell = this.Tables[1].Cell(1, 1);
    cell.Range.Text = "Name"; 
    cell.Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphRight;

See Also

Community Additions

© 2014 Microsoft