TableAlignment enumeration

TableAlignment enumeration

Specifies alignment for an inline table.


LEFTThe table is aligned to the left.
CENTERThe table is centered.
RIGHTThe table is aligned to the right.


Shows how to apply an outline border to a table.

doc = aw.Document(MY_DIR + "Tables.docx")
table = doc.first_section.body.tables[0]

# Align the table to the center of the page.
table.alignment = aw.tables.TableAlignment.CENTER

# Clear any existing borders and shading from the table.

# Add green borders to the outline of the table.
table.set_border(aw.BorderType.LEFT, aw.LineStyle.SINGLE, 1.5,, True)
table.set_border(aw.BorderType.RIGHT, aw.LineStyle.SINGLE, 1.5,, True)
table.set_border(aw.BorderType.TOP, aw.LineStyle.SINGLE, 1.5,, True)
table.set_border(aw.BorderType.BOTTOM, aw.LineStyle.SINGLE, 1.5,, True)

# Fill the cells with a light green solid color.
table.set_shading(aw.TextureIndex.TEXTURE_SOLID, drawing.Color.light_green, drawing.Color.empty()) + "Table.set_outline_borders.docx")

See Also