Search code examples
opentbstinybutstrong

Is it possible to change the format in opentbs when using ope=tbs:num?


When merging blocks using opentbs I was able to properly get a field to merge as a number to excel using ope=tbs:num which I need because I am both displaying the data and performing calculations with it.

However, excel seems to default to displaying all numbers in 0.00 format, i.e. with two decimal places. The majority of the data I'm working with is an integer and I would like to hide the extra decimal places (e.g. ".00") depending on the specific data field being merged so that it's easier to review.

I have tried using ope=tbs:num; frm='0.' and ope=tbs:num; frm='0' but these have not impacted the behavior.

Documentation that seemed to be relevant:

https://www.tinybutstrong.com/opentbs.php?doc#cells

https://www.tinybutstrong.com/manual.php (specifically the 'frm' section)

Is something like this possible with opentbs?


Solution

  • Apply a numeric format on the cell in the template, even if the content is a string that contains the TBS field source. Excel will take the numeric format in account as soon as the value of the cell is numeric. That is when the template is merged.

    The documentation will be updated to mention that.