Categories > OpenTBS with DOCX >

Docx table delete rows based on array values

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Alex
Date: 2013-09-16
Time: 16:52

Docx table delete rows based on array values

Hi,
i have a msword table with a number of rows that corresponds to a number of items:

- stanga
- sorio
- camerini
- legnaro
- rubano
- marcon
- bassanello

...and I have an array with the 'ok' value in selected item keys:
$selecteditems [stanga] = 'ok'
$selecteditems [sorio] = 'ok'

in this case, only stanga and sorio are selected...so far so good.

The problem is that I need to delete table rows that are NOT selected (in this case: camerini, legnaro, rubano, marcon, bassanello) but I don't know how to do it...

Could someone give me a hand?
Bye!

Alex


By: Skrol29
Date: 2013-09-16
Time: 22:54

Re: Docx table delete rows based on array values

Hi,

You can use a conditional display like this:

In each row, put a TBS field like this (example with row 'stanga')
[selecteditem.stanga;magnet=tbs:row;ope=mok:ok;noerr]

At the PHP side:
$TBS->MergeFields('selecteditem', $selecteditem);
By: Alex
Date: 2013-09-17
Time: 09:27

[SOLVED] Re: Docx table delete rows based on array values

It works perfectly,

thank you so much!
Alex