insert ForEach tag inside a table

Jan 21, 2010 at 10:04 AM

hello

can anybody tell me how can i insert foreach tag with value-of tag inside it in a table

i want to put foreach tag inside a table with 3 columns

how can i insert ForEach tag in that?

when i insert foreach tag in a cell that is limited to that cell only

 

Regards,

Muneer

 

Coordinator
Jan 21, 2010 at 10:32 AM

What if you first select two (or more) columns and then click the ForEach-tag in the XML-structure taskpane? I think that should work.

Jan 21, 2010 at 12:48 PM

yes i found that same solution

you have to select columns on which u can apply ForEach-tag

 

Coordinator
Jan 22, 2010 at 10:33 AM

By the way: that is probably one of the coolest features of fleXdoc!

I doubt any other document generators exist that can do that! :)

Feb 5, 2010 at 9:16 AM

And how do you implement the ForEach tag(s) when you have 2 levels and want to apply grouping on the first level?

I want something like this:

Year Project
2009 A
  B
2010 C

My data is:

<?xml version="1.0" encoding="utf-8" ?>
<root xmlns="urn:sample" >
  <year>
    <name>2009</name>
 <projects>
   <project>
     <name>A</name>
   </project>
   <project>
     <name>B</name>
   </project>
 </projects>
  </year>
  <year>
    <name>2010</name>
 <projects>
   <project>
     <name>C</name>
   </project>
 </projects>
  </year>
</root>

I tried different scenarios, with 1 ForEach, with 2 ForEach's, but couldn't find anything that works.

Thanks in advance,

Jos 

Coordinator
Feb 5, 2010 at 9:33 AM

What about tables within a table: the first table renders two columns (Year + Project) and a row for each year: table-xpath(ForEach)=/root/year, col1-xpath(ValueOf)=name, col2-xpath(ForEach)=projects/project. In the second column you render a new table where the ForEach renders rows for each project. By playing around with the margins, you should be able to make it appear as a single table.

Feb 5, 2010 at 1:19 PM

That should work.

Thanks Robert.

Jun 5, 2011 at 1:15 PM
Edited Jun 5, 2011 at 1:16 PM

Hi all, I can confirm that this will work *predictably* - in as far as Word can be called predictable. Construct your tables carefully, running flexdoc transform after each change. I've found that setting zero margin/padding affects the entire table, hence, you need to insert sub-tables to be able to apply margins to those cells. Complex tables (merged or span'd cells) can lead to disaster - so tread carefully and prove your changes each time. I still find it hard to believe that style can't be applied at a level outside the insertion point - seems to be a fact of life though.

Coordinator
Jul 23, 2013 at 7:37 PM
Come check out the successor of fleXdoc: Docati!
It supports Word 2010 and 2013 as well and runs in the cloud.

I sure hope to welcome you as a Docati user as well! :-)

http://www.docati.com