Categories > OpenTBS with XLSX >

Styling Excel sheet field (or row) dynamically with OpenTBS plugin

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Hameed
Date: 2011-07-22
Time: 05:10

Styling Excel sheet field (or row) dynamically with OpenTBS plugin

Hi there,

I would like to give background color, bold/not bold etc for a excel sheet field based on a condition.

Is this possible? Should I use onformat attribute for the field? But I dynamically alter the style.

Thanks for your help.
Hameed
By: Skrol29
Date: 2011-07-25
Time: 01:05

Re: Styling Excel sheet field (or row) dynamically with OpenTBS plugin

If you use a Conditional Format in Excel, then its, definition is saved in the Sheet. And a new <conditionalFormatting> element is defined for each range of cell of the sheet that use conditional format.
This can be a good solution if the cell you want to change do not move by a TBS merging.

Another solution is to change the style of the cell in order to apply another predefined style.
Available styles for the Excel Workbook are saved in the sub-file "xl/styles.xml". Cell style are <xf> elements under the <cellXfs> element . They all have an id which is their place under the <cellXfs> (starting from 0).
A style is applied to cell by adding the attribute: s="styleId", where styleId is 0, 1, 2, ...
So, using TBS and OpenTBS, you can change the style of the cell using a TBS field which have parameter "att".
Example :
PHP:
$newStyleId = 3;
Excel cell:
[onshow.newStyleId;att=c#s]

By: JimH
Date: 2014-09-23
Time: 16:46

Re: Styling Excel sheet field (or row) dynamically with OpenTBS plugin

I've been looking into the Conditional formating in Excel but after merging this it is not working anymore. It is working on 1 cell but not for merging rows (block=tbs:row). Is it possible to change the color of a cell with conditional formatting from Excel when merging rows?