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

Tab in Mergefield

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

By: Michiel
Date: 2015-05-28
Time: 20:29

Tab in Mergefield

It must be very simple, but somehow I can't figure out how to get tabs in my strings that are being merged.
The xml-synopsis says to use
<text:tab/>
, but I don't know how to add these to my text.

Any help?
By: Skrol29
Date: 2015-05-28
Time: 23:49

Re: Tab in Mergefield

You can use a onformat custom function :

PHP :
function f_replace_tabs($FieldName, &$CurrVal, &$CurrPrm) {
   $CurrVal = str_replace("\t",'<text:tab/>', $CurrVal);
   $CurrPrm['strconv'] = 'no'; // prevent from replacing special char such as < and >
}

ODT template :
[my_field;onformat=f_replace_tabs]
By: Michiel
Date: 2015-05-29
Time: 08:26

Re: Tab in Mergefield

Brilliant; just what I need. Thanks!