Jump to content

Centering a table


kshell

Recommended Posts

I'm trying to center text in the cells in a table and it is still aligning left. Here is my code for the start of the table:

 

<table Margins=top:40;bottom:40 Columns=4 alignment=center RowRules=Default:thin,Gray><column width=14500'><column width=7000><column width = 12500><column width = 19550>

Link to comment
Share on other sites

You'll need quotes around your attribute values, but there is no attribute of a table or cell that will center the text in the cell - the alignment attribute of the table tag is the position of the table itself in the text frame. You'll have to use a paragraph tag inside the cell tags to change the alignment of the text within a cell.

return '<table columns="3">' +
'<column width="7200"><column width="7200"><column width="7200">' +
'<row type="body">' +
'<cell rulings="left:thin,black;right:thin,black"><p br="false" quad="L">Left' +
'<cell rulings="left:thin,black;right:thin,black"><p br="false" quad="C">Center' +
'<cell rulings="left:thin,black;right:thin,black"><p br="false" quad="R">Right' +
'</table>';

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...