TinyButStrong - the PHP Template Engine
Categories > OpenTBS with ODS >

Change tag value for coloring cells

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs

By: JimH
Date: 2014-09-26
Time: 09:05

Change tag value for coloring cells

I've been trying to get conditional formating in Excel(ods format) to work without result (see also post http://www.tinybutstrong.com/forum.php?thr=2784):
I can not figure out how to do following:
<table:table-cell office:value-type="string" table:style-name="ce20"><text:p>5395 (S)</text:p></table:table-cell>
This is one row of many where I want the cell to have another back-ground color. How can I change the tag table:style-name="ce20" into table:style-name="ce46" which is the color I want.
By: Skrol29
Date: 2014-09-27
Time: 01:38

Re: Change tag value for coloring cells

Hello,

You can change the value of this attribute with a TBS having parameter "att".
Example:
<table:table-cell office:value-type="string" table:style-name="ce20">
  <text:p>
    [my_block.style_name;att=table:table-cell#table:style-name][my_block.text;block=tbs:row]
  </text:p>
</table:table-cell>
In the example above, your data must have a column named "style_name" that contains the name of the expected style.
If this information is not directly given by the data, you can use parameter "ondata".
By: JimH
Date: 2014-09-30
Time: 15:35

Re: Change tag value for coloring cells

This is great! Thanks a lot Skrol29

There is just one thing that i find annoying about Excel. If you change something in your template, the style-names keep changing value. I'm using Excel 2010 for building templates in ODS format. It is strange that there is a difference between Excel en LibreOffice OSD format.
I have a tab where i make all my special cell styles. This tab can be invisible. This makes it easier to get the style-name (manually)  out of the ODS file. Is there a way to read the table:style-name from a cell. Lets say i have a cell in the hidden tab with the value "higher" and i made the background red. Than the style-name can have a value of "ce6" for example. If i could read the "ce6" from within TBS, than i wouldn't have to do this manually and i wouldn't have to worry about Excel changing the style value every time i made a change to the template.

Keep up the good work.