docx4j-ImportXHTML icon indicating copy to clipboard operation
docx4j-ImportXHTML copied to clipboard

Center table

Open achimmihca opened this issue 4 years ago • 2 comments

Centering a table does not work properly (same for align right).

I tried:

  • <table align="center">...</table>
  • <table style="margin-left:auto; margin-right:auto;">...</table>

The first seems to set a indentation. The second seems to do nothing.

Instead, a jc-element (justification) inside tblPr (tableProperties) should be generated:

...
    <w:tbl>
            <w:tblPr>
                <w:jc w:val="center"/>
...

Above XML is created by MS Word when selecting center under right click on table > table properties


As workaround for now, one can set margin-left to a fitting value if the table width is known.

achimmihca avatar Jan 06 '21 13:01 achimmihca

hey @achimmihca i am also facing the same issue with alignment. Has there been any development or updates on this.

Abhinandan578 avatar Jan 19 '23 15:01 Abhinandan578

I don't know of any developments

achimmihca avatar Jan 19 '23 16:01 achimmihca