Hi, how can I programmatically horizontally center the text in a table row / cells ? TIA
M MoiMeme Sep 22, 2008 #1 Hi, how can I programmatically horizontally center the text in a table row / cells ? TIA
G Gordon Bentley-Mix Sep 23, 2008 #2 Set the Alignment property of the ParagraphFormat property of the Range of the selected cell to wdAlignParagraphCenter. For example: ActiveDocument.Tables(1).Range.Cells(1).Range.ParagraphFormat.Alignment=wdAlignParagraphCenter horizontally centres the text in the first cell of the first table in the active document. -- Cheers! Gordon Uninvited email contact will be marked as SPAM and ignored. Please post all follow-ups to the newsgroup.
Set the Alignment property of the ParagraphFormat property of the Range of the selected cell to wdAlignParagraphCenter. For example: ActiveDocument.Tables(1).Range.Cells(1).Range.ParagraphFormat.Alignment=wdAlignParagraphCenter horizontally centres the text in the first cell of the first table in the active document. -- Cheers! Gordon Uninvited email contact will be marked as SPAM and ignored. Please post all follow-ups to the newsgroup.
G Gordon Bentley-Mix Sep 23, 2008 #3 BTW, if you want to centre the text in an entire row, just substitute 'Rows' for 'Cells' - something like this: ActiveDocument.Tables(1).Range.Rows(2).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter which centres the text in every cell in the second row of the first table in the active document. -- Cheers! Gordon Uninvited email contact will be marked as SPAM and ignored. Please post all follow-ups to the newsgroup.
BTW, if you want to centre the text in an entire row, just substitute 'Rows' for 'Cells' - something like this: ActiveDocument.Tables(1).Range.Rows(2).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter which centres the text in every cell in the second row of the first table in the active document. -- Cheers! Gordon Uninvited email contact will be marked as SPAM and ignored. Please post all follow-ups to the newsgroup.
J Jay Freedman Sep 23, 2008 #4 Hi, how can I programmatically horizontally center the text in a table row / cells ? TIA Click to expand... Leaving it up to you to choose the right table and row... With ActiveDocument.Tables(1).Rows(2) .Range.Paragraphs.Alignment = wdAlignParagraphCenter End With
Hi, how can I programmatically horizontally center the text in a table row / cells ? TIA Click to expand... Leaving it up to you to choose the right table and row... With ActiveDocument.Tables(1).Rows(2) .Range.Paragraphs.Alignment = wdAlignParagraphCenter End With
M MoiMeme Sep 23, 2008 #5 MoiMeme said: Hi, how can I programmatically horizontally center the text in a table row / cells ? TIA Click to expand...
MoiMeme said: Hi, how can I programmatically horizontally center the text in a table row / cells ? TIA Click to expand...