2014-11-28 1 views
0
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 문서에서 실행할 때 (잘못된 형식) : 직선적으로 응답하고 있습니다.xdocreport 및 속도를 사용하여 행 형식의 목록 데이터를 표시하는 방법

3/1/2014 3/4/2014 cd1 decs1 1/3/2014 3/4/2014 cd2 decs2 1/3/2014 3/4/2014 cd3 decs3 3/3/2014 3/4/2014 cd4 decs4 .....

Please help me on this any one ... 

답변

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 일 수 있습니다.

+0

감사합니다. jitesh, 나는 map.put ("newLine", "/ n")과 같은 코드를 작성했다고 말한 것을 따랐습니다. context.put ("content", map); 그렇다면«before-cell # foreach ($ dosData에서 $ d)와 같은 워드 문서에서 액세스했습니다.«이전 셀 # foreach ($ f에서 $ d)»« $ f»«@ after-cell # end» «$ content.newLine» «@ after-cell # end» – Hari

+0

하지만 적절한 응답을받을 수는 없습니다. 일부 문제는 \ n 또한 일부 문제가 있습니다. 텍스트의 – Hari

+0

map.put ("newLine", "/ n");을 사용 했습니까? ? 개행 문자는 \ n이지/n이 아닙니다. 그냥 오타가 아닌지 확인하십시오. – Jitesh

관련 문제