0

I use PHP to merge into a docx. Instead of merging several blocks, I thought of merging multiple arrays into one like this:

PHP:

$allLists = array(
   array('name'=>'specialList', 'list'=>array( 'special1', 'special2', 'special3' ) ),
   array('name'=>'individuelList', 'list'=>array( 'individuel1', 'individuel2', 'individuel3' ) ),
   ...
);

$TBS->MergeBlock('list', $allLists);

And then only display one of the arrays at a time. So I tried this in Word:

1
[list; block=tbs:p+tbs:p;sub1=list; when [list.name]= 'specialList']
•   [list_sub1.val; block=tbs:p; when [list_sub1.val]!='']
2
3
4
[list; block=tbs:p+tbs:p;sub1=list; when [list.name]= 'individuelList']
•   [list_sub1.val; block=tbs:p; when [list_sub1.val]!='']
5

But somehow the merge removes whatever is in between like:

1

•   special1
•   special2
•   special3

•   individuel1
•   individuel2
•   individuel3
5 

Any suggestions?

NicklasF
  • 863
  • 3
  • 10
  • 26
  • Change `!=’’` to `!=''` -- Doesn't look like much, but I'd bet there's your syntax error – Zak Jan 10 '18 at 17:47
  • If the definition of the `list` block is duplicated twice, it may be because it is embedded into a parent TBS block that is not mentioned in your description. If the definition of the `list` block is not duplicated, can you give the actual result that you have after the merge ? – Skrol29 Jan 11 '18 at 11:10
  • The apostrophes didn't helped. @Skrol29, I've changed the question to hopefully be more understandable. – NicklasF Jan 11 '18 at 23:24
  • Blocks with same name (in this case `list`) are regarded as one list. Line 2,3,4 does not belong to any block, so they are not merged into the final list. Think: what should tbs do when individualList come before specialList? If you want to merge two independent lists, you should separate the lists like `[list.0; ...]` and `[list.1; ...]` – Sheepy Mar 01 '18 at 05:47

0 Answers0