Dynamic table

160 views
Skip to first unread message

j_nemo2

unread,
Aug 21, 2012, 3:05:55 PM8/21/12
to jodrepor...@googlegroups.com
Hallo everyone,
I'm working with JODreports and I have a problem. I want to make a table which will be like this:

 -------------------------------------
| a1        | a2       | a3       |
 -------------------------------------
| a4                                |
 -------------------------------------
| a5        | a6       | a7       |
 -------------------------------------
| a8                                |
 -------------------------------------

and I cannot deal with it. 

I can make only this:
TABLE 1

 -------------------------------------
| a1         | a2        | a3       |
 -------------------------------------
| a4         | a5        | a6       |
 -------------------------------------


JOOScript:

 
@table:table-row
[#list items as item]
@table:table-cell
[#list item as cell]
@/table:table-cell
[/#list]
@/table:table-row
[/#list]


 
JAVA code

Map model = new HashMap();
List items = new ArrayList();
model.put("items", items);
    
for (int i=1;i<=9;) {        
       List item = new ArrayList();
       item.add("a"+i++);
       item.add("a"+i++);
                item.add("a"+i++);
                items.add(item);
        }


or TABLE 2

 -------------------------------------
| a1         |           |          |
 -------------------------------------
| a2                                |
 -------------------------------------
| a3         |           |          |
 -------------------------------------
| a4                                |
 -------------------------------------


JOOScript:

 -------------------------------------
| ${line}     |           |          |
 -------------------------------------
| ${line}                            |
 -------------------------------------
In first line:
@table:table-row
[#list lines as line]
  [#if (line_index % 2) = 0]
  [#-- next row contains else and ends list --]

In second line:
@table:table-row
[#-- continue IF started by previous row --]
  [#else]

@/table:table-row
[#-- end stuff started by previous row --]
  [/#if]
[/#list]


 
JAVA code
List lines = new ArrayList();

 for (int i = 1; i <= 6; i++) {
    lines.add("a"+i);
  }
Map model = new HashMap();
model.put("lines", lines);
table1.odt
table2.odt
Reply all
Reply to author
Forward
0 new messages