Categories > OpenTBS with DOCX >

Conditional start and end tags with nested content

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Jonathan Hill
Date: 2016-12-01
Time: 14:30

Conditional start and end tags with nested content

Hello,

I'm new to TBS/OpenTBS so sorry if this is a bit basic.

What I'm trying to do is take a table in a docx document and either display or not display the table using a start tag and end tag inserted before and after the table. The table would just be normal static content produced in Word. The start tag and end tag would be inserted manually in the usual way. I would be able to pass a boolean flag variable to the start tag which would mean the table inside the tags would either be displayed or not displayed. I have tried various ways of using the begin and end tags and other things but I can't find a way of doing this. there is a way of excluding repeat blocks which I am aware of but i cannot figure out how to include or exclude whole sections of the doc in this way. As a bonus I would be able to have tags in the table itself which could be used to insert data into it in the usual way.

Any advice would be appreciated.
By: Skrol29
Date: 2016-12-02
Time: 02:34

Re: Conditional start and end tags with nested content

Hello Jonathan,

Using the syntax with "block=begin" and "block=end" is a bit risky with OpenTBS because you may cut an inner XML entity without be able to check easily.
The best way with OpenTBS is to use the relative syntax : "block=tbs:table", "block=tbs:p", ...

It become easy to have a conditional display on a table : just place this inside the table : [onload.my_boolean_01;when [val]=1;block=tbs:table]
By: Jonathan Hill
Date: 2016-12-07
Time: 17:16

Re: Conditional start and end tags with nested content

Great thanks. Another question. IS there a way you can use title or name of a chart to remove the chart from the doc? If I do OPENTBS_DEBUG_INFO I get a list of chart names. It would be good if I could remove the table using only php without the need for tags in the doc. I can see how the method you explain would use for a tabular style element but I can't see how it would work for a chart?? And it would be good to be able to assign some kind if metadata to elements so that you could remove them using a specific attribute relating to the metadata.
By: Skrol29
Date: 2016-12-11
Time: 22:46

Re: Conditional start and end tags with nested content

In order to delete a chart, you simply have to delete element <w:drawing>.

So you can put in the Description property:
[onload.my_boolean_01;when [val]=1;block=w:drawing]