2

I am using TBS to create an MS Word Document from a template in PHP and trying to remove a table depending on a boolean variable.

What I'm trying to do is similar to the following code, but I want to remove a table rather than an object...

[onload;block=mc:AlternateContent;when [var.x_delete]=0]
Skrol29
  • 5,402
  • 1
  • 20
  • 25
Dan
  • 1,447
  • 2
  • 14
  • 30

1 Answers1

3

I guess you are using TBS with its plugin OpenTBS.

In MS Word, a table is bounded with the element <w:tbl>.

Thus the TBS tag for deleting such a table would be:

[onload;block=w:tbl;when [var.x_delete]=0]

OpenTBS is provided with a synopsis of the main elements of MS Office and LibreOffice.

w5m
  • 2,286
  • 3
  • 34
  • 46
Skrol29
  • 5,402
  • 1
  • 20
  • 25
  • This is perfect. I didn't apprievate table. Cheers – Dan Sep 17 '12 at 13:40
  • It's worth noting that the TBS tag should be added to the table itself (rather than before/after the table) and it's necessary to use onshow instead of onload if you want to refer to a merged data value (e.g. from a SQL query). – w5m Sep 15 '16 at 10:19
  • You can use `block=tbs:table` instead of `block=w:tbl`. "tbs:table" is an alias and makes the template clearer. – Skrol29 Sep 16 '16 at 15:06