Evgenii Kozlov
Evgenii Kozlov

Reputation: 73

Align Word table

Is there a way how to align a table itself, not it's contents?

I want this:

enter image description here

but not this

enter image description here

I tried the following (code is for Python, but that's almost the same for VBA of C#):

word_table = self._word_app.Selection.Tables(1)
    
word_table.Range.ParagraphFormat.Alignment = client.constants.wdAlignParagraphCenter
word_table.Range.Paragraphs.Alignment = client.constants.wdAlignParagraphCenter

word_table.Select()
self._word_app.Selection.Range.ParagraphFormat.Alignment = client.constants.wdAlignParagraphCenter

But it only aligns contents. Any idea how to make it work?

Upvotes: 0

Views: 130

Answers (1)

Timothy Rylatt
Timothy Rylatt

Reputation: 7850

word_table.Rows.Alignment = client.constants.wdAlignRowCenter

Upvotes: 1

Related Questions