0

Is there a way to set the font color in table rows? I'm using the PHP class of tbs and ODT documents. It would be perfect to be able setting individual colors to each row. But I don't know if it's possible.

I have a HTML table with different colors and want to convert it to an ODT document.

Martin
  • 59
  • 1
  • 6

1 Answers1

0

In XML for ODT documents, it is not possible to define a font color directly on a table row, a table cell, or a paragraph that contain the text in the cell. You can only apply a style to those elements.

So the solution is to defined a named Paragraph Style for each font color you need in your table, and then changing the style of the paragraph (a text in cell is always in a paragraph) with a TBS field using parameter att. Example : [blk.my_style;att=text:p#table:style-name]

Unfortunately there is an additional difficulty: LibreOffice will save your custom style with an internal name. The name you give to it using the software is only a displayed name (an alias). So the solution is to look in the styles.xml file for the internal name. Or you can wait for the next TBS version (3.11): it will have a feature for reading attributes in the template.

Skrol29
  • 5,402
  • 1
  • 20
  • 25
  • Thank you for your answer. The problem is that my color values are dynamic. So I have to create the paragraph styles dynamically. Is that possible in the new version of TBS? – Martin Oct 24 '18 at 08:24
  • unfortunately not :-( – Skrol29 Oct 26 '18 at 09:33