Assign multiple classes to an element

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
JuMo
Propeller Head
Posts: 55
Joined: Fri May 03, 2013 4:46 am

Assign multiple classes to an element

Post by JuMo »

In my example I have a table cell (td or th) and I want to assign multiple classes to it, e.g. a class to affect the background color and another one to affect the border color.
However, if I try to assign two classes the other one will be removed. I would need to go to the code-view and write it here. But this is no good usability and user experience
for users which aren't familar with code. So what can be done to solve it? I definitly need two separate classes. If I would combine them in each variant, I would have up to
50 classes...

Cheers.
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: Assign multiple classes to an element

Post by NorthEast »

You cannot apply two classes in Flare's XML editor, you have to do it manually in text editor view.
Like me, if that's something you'd like to see - put in a feature request to MadCap.

Have you looked at Flare's table stylesheet editor?
It is fairly flexible - you can set up a table stylesheet where you can select different formats for individual rows or columns.
You can't format individual cells though.
JuMo
Propeller Head
Posts: 55
Joined: Fri May 03, 2013 4:46 am

Re: Assign multiple classes to an element

Post by JuMo »

Well, this is a huge problem. My customers are technical authors without HTML knowledge, so this is an essential point.
I need to talk with our CTO and maybe think about an extension.

I'm shocked that this is not built in. On complex tables e.g. you need
- striped classes
- color classes
- border classes
- divider classes
- space classes
- ...

If I would multiplicate them I would have > 50 classes :shock:
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: Assign multiple classes to an element

Post by NorthEast »

That's why I suggest to try out Flare's table stylesheet editor, as you can probably do most of those things.
Paul Griffiths
Sr. Propeller Head
Posts: 262
Joined: Wed Apr 18, 2007 2:25 am
Location: Nottingham, UK

Re: Assign multiple classes to an element

Post by Paul Griffiths »

Another way to do it that doesn't require access to the Text Editor is to use the Attributes window (Shift-F12).

Select the td or th by using the structure bar, Shift+F12, then type the classes you want (separated by spaces) in the class field.

But Dave is right, table styles are probably your best bet.
JuMo
Propeller Head
Posts: 55
Joined: Fri May 03, 2013 4:46 am

Re: Assign multiple classes to an element

Post by JuMo »

Yes I already know the "Attribute"-panel. However, it is not possible to assign the same class attribute to multiple selected elements. You need so select each th or td element manually.
Also, this only works if you know the class names or you have opened the "Format"-panel too.

I had a look at the Tables Guide. Do you really think you can realize e.g. such a table with it?
https://www.lowvoltage.siemens.com/tecd ... 51-d2e6021

From my point of view this and much more complex tables can only be realized with classes.
In my case technical authors should not define layout informations manually. They should
only apply a class, that layout changes can be done easier and realization times are shortened.
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: Assign multiple classes to an element

Post by NorthEast »

JuMo wrote:I had a look at the Tables Guide. Do you really think you can realize e.g. such a table with it?
https://www.lowvoltage.siemens.com/tecd ... 51-d2e6021
Yes, you should be able to set that up with a table stylesheet.
At least give it a try, rather than assuming it won't work.
Pay particular attention to how you set up row and column styles; you can set these up as a pattern (for repeating patterns, like alternate shading), or as a custom style which you can apply manually to a row or column.

Another thing to note about using multiple classes - that will only work for help outputs, it won't work for PDF.
JuMo
Propeller Head
Posts: 55
Joined: Fri May 03, 2013 4:46 am

Re: Assign multiple classes to an element

Post by JuMo »

I gave the TableStyle Editor a try. Great that such an helper exists. However, I don't think it is the right thing for my use case.
The reason is, that you can only apply one style format to a <tr>-element for example. Let's say you create one format that will add a green background
and another one to center the text. It is necessary to separate this two formats because you may want to add only one of it.
However, in the TableStyle Editor you would need to create a format with both properties, one without anything, and two separate.
So you actually need to multiplicate the "classes" because you can't add multiple formats to an element.
From my point of view this is the same problem as for common "formats".

Am I missing something?
JuMo
Propeller Head
Posts: 55
Joined: Fri May 03, 2013 4:46 am

Re: Assign multiple classes to an element

Post by JuMo »

I assume that you agree with my findings. So I will think of an extension to allow multiple classes. I am not sure if this will cause side-effects, because I don't know why this has not been made possible.
Post Reply