Tblestyle with Left Column as header

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
Pamb10
Sr. Propeller Head
Posts: 126
Joined: Wed Feb 01, 2006 2:08 pm
Location: Florida
Contact:

Tblestyle with Left Column as header

Post by Pamb10 »

Is this possible? If so, can someone please direct me on how to set the leftmost column as a header?

Thanks.
Pam
SteveS
Senior Propellus Maximus
Posts: 2090
Joined: Tue Mar 07, 2006 5:06 pm
Location: Adelaide, far side of the world ( 34°56'0.78\"S 138°46'44.28\"E).
Contact:

Re: Tblestyle with Left Column as header

Post by SteveS »

Hi Pam,

Given the structure of HTML I would say the strict answer is no. (IMHO, a guru may correct me on that.)

There may be, however, a workaround. What are you trying to achieve?
Image
Steve
Life's too short for bad coffee, bad chocolate, and bad red wine.
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Tblestyle with Left Column as header

Post by LTinker68 »

Not directly through the GUI, at least, not that I could see. The easiest way would be to create a 2 or more column, 1 row table, with no header or footer row. Specify a table stylesheet, if you want.

If you are not using a table stylesheet:
Put the cursor in the first cell. In the Styles pane or Styles drop-down menu, select th to change it from a normal cell to a header cell. Put the cursor in the second cell and make sure it shows it as a <td> tag (turn on the show table rows option if you don't have it on). Once you have the row set up correctly, use the Table > Insert menu to add rows to the table. Each row will pick up the tags from the first row, which is <th> for the first cell and <td> for all subsequent cells.


If you are using a table stylesheet:
Save the topic, then open it in the Internal Text Editor. Manually change the tags for the first cell from <td> and </td> to <th> and </th>, respectively. So if your table looks like the following (style names may vary)...

Code: Select all

<table style="mc-table-style: url('Resources/TableStyles/NewStyle.css'); margin-left: 0; margin-right: auto;" class="TableStyle_Basic" cellspacing="0">
     <tbody>
          <tr>
               <td class="TableStyle_Basic_Body_0_0_RowSep_ColSep">header</td>
               <td class="TableStyle_Basic_Body_0_0_RowSep_ColEnd">content</td>
          </tr>
     </tbody>
</table>
... then change it to the following (notice the "header" row now has <th> tags, not <td> tags)...

Code: Select all

<table style="mc-table-style: url('Resources/TableStyles/NewStyle.css'); margin-left: 0; margin-right: auto;" class="TableStyle_Basic" cellspacing="0">
     <tbody>
          <tr>
               <th class="TableStyle_Basic_Body_0_0_RowSep_ColSep">header</th>
               <td class="TableStyle_Basic_Body_0_0_RowSep_ColEnd">content</td>
          </tr>
     </tbody>
</table>
Save the topic and close it from the Internal Text Editor. Back in the normal authoring view, use the Table > Insert menu to add additional rows. They will again pick up the tags and styles defined in the first row. I didn't try this with alternating rows or columns in the table stylesheet, so you'll probably have to do more editing in the Internal Text Editor if you're using either alternating rows or columns.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: Tblestyle with Left Column as header

Post by NorthEast »

I'd use LTinker's first method: add a table that doesn't have a table stylesheet, make sure it has no header row, then just select all the cells in your left column and click th from the style list.

Obviously you'd need to set up styles for td, th, table, etc. if you haven't already.

---

I would advise against using the second method; mainly because if you manually edit a table that uses a table stylesheet, your changes can be lost if you later modify the table's layout or stylesheet - Flare will reformat the table's tags and classes.

Also, the method described wouldn't work; it's not just a case of changing the td to th, you would also need to set the right class.

It wouldn't be: <th class="TableStyle_Basic_Body...
it'd be something like: <th class="TableStyle_Basic_Head...
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Tblestyle with Left Column as header

Post by LTinker68 »

Dave Lee wrote:I would advise against using the second method; mainly because if you manually edit a table that uses a table stylesheet, your changes can be lost if you later modify the table's layout or stylesheet - Flare will reformat the table's tags and classes.
That occurred to me, but I forgot to mention it. It doesn't mean that you can't do that, it just means that you'd better have your table stylesheet defined before you get too many rows into the table, because if you later change one of the styles then the table will be redrawn and you'll have to redo the tag changes, but on a lot more rows.

Dave Lee wrote:Also, the method described wouldn't work; it's not just a case of changing the td to th, you would also need to set the right class.

It wouldn't be: <th class="TableStyle_Basic_Body...
it'd be something like: <th class="TableStyle_Basic_Head...
Actually, it does work with the _Body class on the <th> line. If you specify that you want a header row, then Flare will use the _Head class, but if you didn't specify that you wanted a header row, then you can still use the _Body class with the <th> tag. At least, it worked in the test I did. If you leave the _Body class in place, then it'll pick up some styles for the <th> tag from the main topic stylesheet or HTML standards (e.g., centered and bold) and the rest of the styles will come from the _Body class. Since it worked, I'm guessing that the _Head and _Body styles are generic classes, not tag-specific, although I didn't open up the table stylesheet to verify.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: Tblestyle with Left Column as header

Post by NorthEast »

LTinker68 wrote:Actually, it does work with the _Body class on the <th> line...
It certainly doesn't work for any of my table styles - if it does for you then that's pure luck.

The body cell class may have quite different properties from the header cell class; in my case it'd come out a completely different colour.
In your tests, your base th style and body class from the table stylesheet must roughly match the table stylesheet's header style; but that's just good fortune.
Post Reply