Java code:
------------------------------------
List dosData = new ArrayList();
for (int x = 0; x < ti.getRowCount(); x++){
String[] rowContent = ti.getRow(x);
List<String> listData = new ArrayList<String>();
for(int i = 0;i<rowContent.length;i++){
listData.add(rowContent[i]);
}
dosData.add(listData);
}
If I print dosData variable:
system.out.println(dosData);
--------------------
[1/3/2014, 3/4/2014,|(list contains lists)
cd1, decs1] |
------------------- |
[1/3/2014, 3/4/2014,|
cd2, decs2] |
------------------- |
[1/3/2014, 3/4/2014,|
cd3, decs3] |
------------------- |
[1/3/2014, 3/4/2014,|
cd4, decs4] |
-------------------
I want to display above content in word document in the form row format, I have tried below code to display
------------------------------------------
«@before-cell#foreach($d in $dosData)» |
«@before-cell#foreach($f in $d)» |
«$f» |
«@after-cell#end» |
«@after-cell#end» |
--------------------------------------------
Its working,But it is not getting required format what we want,Below is the expected result what we want.
Expected format:
---------------
1/3/2014 3/4/2014 cd1 decs1
1/3/2014 3/4/2014 cd2 decs2
1/3/2014 3/4/2014 cd3 decs3
1/3/2014 3/4/2014 cd4 decs4
我在word文档中运行上面的代码时遇到的实际格式(格式错误):线性地我们得到了响应。
1/3/2014 3/4/2014 cd1 decs1 1/3/2014 3/4/2014 cd2 decs2 1/3/2014 3/4/2014 cd3 decs3 1/3/2014 3/4/2014 cd4 decs4 .....
Please help me on this any one ...
答案 0 :(得分:0)
你需要在内部循环后添加一个新的行字符。
«@before-cell#foreach($d in $dosData)» |
«@before-cell#foreach($f in $d)» |
«$f» |
«@after-cell#end»
new line character |
«@after-cell#end»
换行符可以是\ n,\ r或\ n \ r。