Expand Minimize
1 out of 7 rated this helpful - Rate this topic

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

NoteNote

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

Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.