Aligning Table Column Content

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
Telecaster52
Propeller Head
Posts: 32
Joined: Tue Dec 01, 2020 2:22 pm

Aligning Table Column Content

Post by Telecaster52 »

Hello

I assume this is a topic that has been posted numerous times, but the answers don't quite seem to apply to my situation, or I'm just really bad at finding the answer.

I created a table with several rows and several columns (hence, a table). How do I align the row content so that aligns by column? In other words, how do I get the column content to align vertically in a PDF output? Is there an easy way to perform this task?

Thank you.
robdocsmith
Sr. Propeller Head
Posts: 247
Joined: Thu May 24, 2018 3:11 pm
Location: Queensland, Australia

Re: Aligning Table Column Content

Post by robdocsmith »

Not sure what you mean exactly. If you mean make the text in each row align vertically centred in that row, then apply a "vertical-align: middle;" to the <td> defintions, either in the tablestyle or as a general style if you aren't using tablestyles. See https://developer.mozilla.org/en-US/doc ... ical-align for information.
If you want to vertical align the entire table on a page, you'd have to change the margin-top/margin-bottom of the table to add space as desired. Or you could create a <div> element with a fixed height and "vertical-align: middle;" property then create your table inside it.

Cheers,
Rob
Telecaster52
Propeller Head
Posts: 32
Joined: Tue Dec 01, 2020 2:22 pm

Re: Aligning Table Column Content

Post by Telecaster52 »

I'm trying to modify the content in each cell of a column so it vertically aligns with the the content of the cell above and below it. So far, no luck.
robdocsmith
Sr. Propeller Head
Posts: 247
Joined: Thu May 24, 2018 3:11 pm
Location: Queensland, Australia

Re: Aligning Table Column Content

Post by robdocsmith »

For centre aligning of text...
If all cells are always centre-aligned, you could add the property "text-align: center;" to the TD element in your style sheet.
If only certain cells or certain parts of cells are centre-aligned, you could create a SPAN class called "centred" and add "text-align: center;" to it.
The equivalent using local formatting instead of a style change would be to highlight the column and choose centered from the tool bar (Paragraph section of Home tab).

To horizontally align text other than centred, use a <p> inside each table cell and use the padding/margin properties of that <p> class. Or if you want to avoid using a <p> in a table cell, add padding as appropriate to the <td> class itself.

Rob
Post Reply