Defining fonts in table styles

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
beelia
Propeller Head
Posts: 23
Joined: Wed Mar 28, 2007 12:30 pm
Location: Mountain View, CA
Contact:

Defining fonts in table styles

Post by beelia »

I don't understand the correspondence between the main stylesheet and the tables stylesheet. And in particular,
I don't get how I can change the font in a particular table style without affecting all of the other tables in the project.

I do know that if I change a table element (e.g., td) in the main stylesheet, it will override all of my table styles. I also know that making those changes produces a long list of classes with column and row attributes, and I also see those listed in my table stylesheets. I suppose those are produced for each table element every time you make a change.

There are two sections in the table stylesheets - Madcap table styles and Cell styles. Some are preceded by "mcTable" and others are classes of the table element [e.g. .TableStyle_ABC_Table_Style_Head_0_0)].

I thought I could edit the table stylesheet by adding values identifying font styles, sizes and weights, but that didn't work.
Then I tried adding classes in the XML editor to the td and table elements and editing those. That didn't work either.

Can anyone help?
Bee Hanson

NetApp, Inc.
(650) 464-6667 (Cell)
NorthEast
Master Propellus Maximus
Posts: 6359
Joined: Mon Mar 05, 2007 8:33 am

Re: Defining fonts in table styles

Post by NorthEast »

In your main stylesheet, you can set the properties for your normal table styles - i.e. table, td, th, thead, tfoot.

If you use MadCap's table editor, the styles that you set up in that editor are saved in a table stylesheet, and these styles are saved as classes of the standard table tags - as you have seen with things like .TableStyle_ABC_Table_Style_Head_0_0.

When you add a table to your topic, if you don't select a table stylesheet, then the table will use the table styles from your main stylesheet. If you select a table stylesheet for the table, then Flare will reformat the table using the styles from the table stylesheet, which will be applied on top of the styles from your normal stylesheet.

For example, a normal table cell will change from td to something like td.TableStyle_MyTable_Body_0_0_RowSep_ColSep. That cell will have the properties defined for td in your main stylesheet, but these will be overriden by any properties td.TableStyle_MyTable_Body_0_0_RowSep_ColSep in your table stylesheet.

So, if you've set any font properties in your table stylesheets, then they will override the font properties that you've set in your main stylesheet (for tables that use these stylesheets).
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Defining fonts in table styles

Post by LTinker68 »

Dave Lee wrote:So, if you've set any font properties in your table stylesheets, then they will override the font properties that you've set in your main stylesheet (for tables that use these stylesheets).
So long as the table stylesheet is referenced after the main stylesheet in the topic, that is. Generally, when you create a topic you specify the stylesheet to use with it and Flare adds the stylesheet reference to the topic automatically. When you add a table and specify a table stylesheet for it, then Flare adds the (table) stylesheet reference to the topic automatically, and automatically inserts it after the main stylesheet reference. This gives the styles in the table stylesheet preference over the main stylesheet (the table stylesheet is closer to the text, so it wins the challenge).

In the normal course of things, that's the way the stylesheet references are inserted and there shouldn't be any problems. But if the table stylesheet is inadvertently referenced before the main stylesheet, then the styles in your table would look screwed up. As I said, not something that would happen in the normal course of things, but something to look at if your table still isn't behaving properly.
Image

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

Re: Defining fonts in table styles

Post by NorthEast »

I think the majority of the styles in the table stylesheet will be classes of the base table styles though, so that means that the properties in the style class will take precedence. The order of the stylesheets is only important when two identical styles are defined.
beelia
Propeller Head
Posts: 23
Joined: Wed Mar 28, 2007 12:30 pm
Location: Mountain View, CA
Contact:

Re: Defining fonts in table styles

Post by beelia »

Thank you both. Now I understand not only how to read the ascii tablestyles, but also how precedence works in the topic. I've been trying to figure this out for ages. Lisa, you could write a "how it works" book!

Now I want to complete the topic for others who are looking for an easy way to assign fonts to tables that have styles attached. You can literally have a different font in every cell. It took Rick all of two minutes to explain it, and after his explanation it seems obvious and easy.

1. Put your cursor in the cell you want to change.
2. Right-click on the td block.
3. Select Style Class > Create Style Class.
4. Name the class.
5. Attach it to the source element or not (select a radio button).
6. Select a stylesheet to attach it to. It may be the tablestyle (it is listed if it is already attached to the table you're editing), or it could be the main stylesheet.
If you choose the main stylesheet, the class gets added under td in the table section of the SS.
If you choose the tablestyle, you'll have to go to the ascii file to see that it is added at the end.
7. Click Set or OK (on my console the button is obstructed, I don't know what it says).
8. Right-click on the td block again.
9. Select Style Class > Edit Style Class (or you can just find it in the main ss or the ascii tablestyle file).
10.Change the font, or any other attribute in the main stylesheet or the ascii file of the tablestyle.
(If you're editing in the main SS, make sure the Medium is default, not print.)
11.Save.
Now when you go back to the topic, you can right-click on td for each cell. Go to Style Class > and select the style you want to apply from the list.
If you want to apply to the whole table, you can get to these styles by right-clicking Table (either in the block area or on the right edge of the table) and selecting Style Class > select style.

Cool stuff. I didn't know tables in Flare were this configurable.
Bee Hanson

NetApp, Inc.
(650) 464-6667 (Cell)
NorthEast
Master Propellus Maximus
Posts: 6359
Joined: Mon Mar 05, 2007 8:33 am

Re: Defining fonts in table styles

Post by NorthEast »

Actually, I would only use that method for tables that do not use table stylesheets.

I would not recommend using that method for tables that use table stylesheets.
It will appear to work up to a point, but it has a very big limitation - as soon as you edit the table by adding/removing a row or column, you will lose all the cell formatting you applied and have to manually reapply them all again.

For example, say you created a new td class, td.hello

In a table formatted with a table stylesheet, each cells will already have its own td class, e.g. td.TableStyle_MyTable_Body_0_0_RowSep_ColSep

If you apply your own style to that cell, the cell class will change to td.hello and you'll see your new formatting.

Now, that looks ok so far, but if at any point you make any change to the table size or properties, e.g. you add a row or column, then you'll lose the formatting on that cell (and any others you changed).
Flare will reformat table using the table stylesheet styles, i.e. it will change the cell you formatted with td.hello back to td.TableStyle_MyTable_Body_0_0_RowSep_ColSep.
beelia
Propeller Head
Posts: 23
Joined: Wed Mar 28, 2007 12:30 pm
Location: Mountain View, CA
Contact:

Re: Defining fonts in table styles

Post by beelia »

You're right, of course. It's not advisable to make these tiny customizations, but I needed to know everything about how it could be done - because customizing tables is essentially a balancing act.

In short, you really have to know what attributes you have set as a default, and how you're going to build on those attributes with a table style. If you build on several different defaults, as I have done (because I didn't fully understand the table functionality), you're eventually going to have something that doesn't look quite right.

Because I've always been in a hurry when creating a new topic, I've created new table styles quickly. Some tables need to look different to present the information most effectively, and those do have to have a different style. But unfortunately, I built them atop different defaults. Now I'm going back and revising them to create a unified look for all tables in all topics.

They're not bad as is, but now that I have a break (for once I'm ahead of the developers), I'm trying to create a solid system instead of relying on a vague impression that all of the tables generally look alike.

Dave and Lisa, thanks for kicking this around with me - your feedback has helped me to learn a lot in a relatively short time.
Bee Hanson

NetApp, Inc.
(650) 464-6667 (Cell)
evanarsdall
Propeller Head
Posts: 52
Joined: Thu Nov 09, 2006 5:38 am

Re: Defining fonts in table styles

Post by evanarsdall »

Dave Lee wrote:I think the majority of the styles in the table stylesheet will be classes of the base table styles though, so that means that the properties in the style class will take precedence. The order of the stylesheets is only important when two identical styles are defined.
Hi, Dave:

In table style sheets, Flare defaults to using centered text in header rows, and I want it to be left-aligned. Since the GUI for table style sheets offers no obvious way to change text alignment (i.e., the sample table is a preview only and can't be manipulated), I have changed the text-align property in various table styles in my main style sheet: td, th, thead, tfoot, tbody... every style I can find that's related to tables. Thee header text still won't budge.

Based on this discussion, I have opened the topic in a text editor and changed the order of the style sheets, but nothing is making a difference. The only thing I can do is manually change the text alignment using local formatting.

Do you have any advice or suggestions for controlling text alignment in table style sheets?

Thanks,
Eddie
NorthEast
Master Propellus Maximus
Posts: 6359
Joined: Mon Mar 05, 2007 8:33 am

Re: Defining fonts in table styles

Post by NorthEast »

evanarsdall wrote:I have changed the text-align property in various table styles in my main style sheet: td, th, thead, tfoot, tbody... every style I can find that's related to tables. Thee header text still won't budge.
I created a brand new empty project and set the th style with text-align: left, and it works fine for all tables (with or without table stylesheets).

Neither the standard factory stylesheet (Styles.css) nor the table stylesheet (Basic.css) include any font alignment setting for the table header, I think the centre alignment is a browser default.

If you're still getting centred text, then I'd double-check your stylesheet and make sure you don't have any inline formatting.
evanarsdall
Propeller Head
Posts: 52
Joined: Thu Nov 09, 2006 5:38 am

Re: Defining fonts in table styles

Post by evanarsdall »

Dave Lee wrote:If you're still getting centred text, then I'd double-check your stylesheet and make sure you don't have any inline formatting.
No, I don't have any inline formatting at all. All of my projects have a styles-only policy, so I only used the local formatting toolbar to test my ability to override the text-align=centered property in a single topic.

Centering may be a browser default, but when I create Web pages, I routinely control the text-align property using a linked or imported style sheet.

I do note when I examine the tags that the auto-generated code from the table style sheet generates its own inline styles (style="text-align:center"). I could change the values there, but as you or someone stated in another post, if I later change anything in the table style sheet and reapply the format, the table style sheet will override my override.

This method makes no sense to me. Could it possibly be because the original style sheet originated from RoboHelp?
Eddie
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Defining fonts in table styles

Post by LTinker68 »

Dave Lee wrote:Neither the standard factory stylesheet (Styles.css) nor the table stylesheet (Basic.css) include any font alignment setting for the table header, I think the centre alignment is a browser default.
Yes, the <th> tag being centered is default behavior (in HTML/CSS, not just in Flare). If you don't want them centered, then you have to specify the text-align property on the tag. Likewise, I believe <td> tags are set to be vertically aligned to the center of the cell, so if you want your text in each cell to be at the top of the cell, then you have to set the vertical-align property to top in the <td> tag.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
evanarsdall
Propeller Head
Posts: 52
Joined: Thu Nov 09, 2006 5:38 am

Re: Defining fonts in table styles

Post by evanarsdall »

LTinker68 wrote:If you don't want them centered, then you have to specify the text-align property on the tag. Likewise, I believe <td> tags are set to be vertically aligned to the center of the cell, so if you want your text in each cell to be at the top of the cell, then you have to set the vertical-align property to top in the <td> tag.
But I have already done what you're suggesting. I routinely create and modify style sheets, both inside and outside of Flare, and normally I just set the text-align property to whatever I need. (I also know where to change vertical alignment but don't want to change it in this case.)

In this case, I simply want to change the horizontal alignment of header row text from center to left, to match the td text in the table. But Flare's default for table styles is to center the header row text, and at least in my case, changing the appropriate properties in the main style sheet has no effect.

I have also opened the topic where the first instance of the table appears in the internal text editor and changed the order of the stylesheet references. That had no effect, either. My only recourse seems to be to apply local formatting.
Eddie
KevinDAmery
Propellus Maximus
Posts: 1985
Joined: Tue Jan 23, 2007 8:18 am
Location: Darn, I knew I was around here somewhere...

Re: Defining fonts in table styles

Post by KevinDAmery »

evanarsdall wrote:
LTinker68 wrote:If you don't want them centered, then you have to specify the text-align property on the tag. Likewise, I believe <td> tags are set to be vertically aligned to the center of the cell, so if you want your text in each cell to be at the top of the cell, then you have to set the vertical-align property to top in the <td> tag.
But I have already done what you're suggesting. I routinely create and modify style sheets, both inside and outside of Flare, and normally I just set the text-align property to whatever I need. (I also know where to change vertical alignment but don't want to change it in this case.)

In this case, I simply want to change the horizontal alignment of header row text from center to left, to match the td text in the table. But Flare's default for table styles is to center the header row text, and at least in my case, changing the appropriate properties in the main style sheet has no effect.

I have also opened the topic where the first instance of the table appears in the internal text editor and changed the order of the stylesheet references. That had no effect, either. My only recourse seems to be to apply local formatting.
Ok, you mentioned in your first post that you edited the properties of the TD tag--did you also edit the properties of the TH tag? Table headings use TH, not TD, so you would need to explicitly edit the TH tag to apply changes to headings.
Until next time....
Image
Kevin Amery
Certified MAD for Flare
evanarsdall
Propeller Head
Posts: 52
Joined: Thu Nov 09, 2006 5:38 am

Re: Defining fonts in table styles

Post by evanarsdall »

KevinDAmery wrote:Ok, you mentioned in your first post that you edited the properties of the TD tag--did you also edit the properties of the TH tag? Table headings use TH, not TD, so you would need to explicitly edit the TH tag to apply changes to headings.
No, actually th was the first and only tag that I originally edited. Since it had no effect, I edited any table tag that had a text-align property to make sure that they were all set to left. (Call it a desperate experiment.) Unfortunately it still didn't solve the problem with the header row.

This isn't the biggest deal, but it's a bit bizarre. I never have this issue with CSS table styles in any other context.
Eddie
KevinDAmery
Propellus Maximus
Posts: 1985
Joined: Tue Jan 23, 2007 8:18 am
Location: Darn, I knew I was around here somewhere...

Re: Defining fonts in table styles

Post by KevinDAmery »

Ok.... here's another thought. Can you double check that you don't have duplicate CSS files in your project? I ran into this while helping another user a few months ago: somehow, he had gotten a copy of his CSS in both the Content folder and in the Content\Resources\Stylesheets folder (in his case it happened because of a Robohelp import). The problem he was having was that changes he made to the CSS weren't appearing in the topics - the reason was that the topics were referring to the file in the Stylesheets folder but he was making his changes to the one in the Content folder. The problem you're describing sounds similar, so it's worth checking to see if you inadvertently ended up with duplicate file names somehow.
Until next time....
Image
Kevin Amery
Certified MAD for Flare
evanarsdall
Propeller Head
Posts: 52
Joined: Thu Nov 09, 2006 5:38 am

Re: Defining fonts in table styles

Post by evanarsdall »

KevinDAmery wrote:Ok.... here's another thought. Can you double check that you don't have duplicate CSS files in your project?
BINGO! I found an extra copy of a style sheet in the middle of some standalone topics. I verified that my topics are all linked to the correct master style sheet, and I removed the copy from my project. Now I'm seeing tables that look the way I want them to. A beautiful thing.

Thanks so much, Kevin!
Eddie
KevinDAmery
Propellus Maximus
Posts: 1985
Joined: Tue Jan 23, 2007 8:18 am
Location: Darn, I knew I was around here somewhere...

Re: Defining fonts in table styles

Post by KevinDAmery »

Glad to help.
Until next time....
Image
Kevin Amery
Certified MAD for Flare
Post Reply