Is there is any way to make TBS automaticly choose when cell need to be numeric (ope=xlsxNum)? Or is it posible to use if or when for ope?
Here is a tip and trick that should work.
The difficulty is that in case of MergeBlock, formating parameters such as "ope=xlsxNum" are processed before the data are injected. This is for performance consideration. So we are going to merge the data twice: one for preparing TBS fields for the formating, and a second one for actually injecting data using MergeField() instead of MergeBlock().
Here is an example of data as a PHP array:
$data = array(
array('name'=>"Nom", 'type'=>'STR', 'value'=>'Jack');
array('name'=>"Stock", 'type'=>'NUM', 'value'=>1305);
array('name'=>"Value", 'type'=>'NUM', 'value'=>1.5498888);
);
Put the follong snippet in the cell:
[b2.[b1.$;block=c].value;[b1.type;if '[val]'='NUM';then 'ope=xlsxNum'; else '']]
And at the PHP side:
$TBS->MergeBlock('b1', $data); // prepare TBS fields with corresponding formating
$TBS->MergeField('b2', $data); // merge TBS fields with corresponding data
After 'b1' is merged, the template becomes:
[b2.0.value;] | [b2.0.value;ope=xlsxNum] | [b2.0.value;ope=xlsxNum]
After 'b2' is merged, the template becomes:
Jack | 1305 | 1.5498888