2013-03-29 3 views
0

Jasper 보고서의 columnFooter에 textFields를 동적으로 추가하는 방법이 있습니까? 내가 알고하지 않기 때문에 텍스트 필드의 수를JasperReports에서 동적으로 textField 추가

<columnFooter> 
     <band height="21" splitType="Stretch"> 
     <textField isStretchWithOverflow="true"> 
      <reportElement x="0" y="0" width="50" height="21"/> 
      <textElement textAlignment="Center" verticalAlignment="Middle"/> 
      <textFieldExpression><![CDATA["Example text...."]]></textFieldExpression> 
     </textField> 
     </band> 

또는

 <columnFooter> 
     <band height="42" splitType="Stretch"> 
     <textField isStretchWithOverflow="true"> 
      <reportElement x="0" y="0" width="50" height="21"/> 
      <textElement textAlignment="Center" verticalAlignment="Middle"/> 
      <textFieldExpression><![CDATA["Example text...."]]></textFieldExpression> 
     </textField>   <textField isStretchWithOverflow="true"> 
      <reportElement x="0" y="0" width="50" height="21"/> 
      <textElement textAlignment="Center" verticalAlignment="Middle"/> 
      <textFieldExpression><![CDATA["More example text...."]]></textFieldExpression> 
     </textField> 
     </band> 

(또는 추가합니다.

내가 사용해야 할 수도 있습니다 상황이 몇 개가 더 추가 될지, 동적으로 밴드의 크기를 조정해야 함) 나는 dynamicall에 대한 방법을 찾고있다. y Java에서이 작업을 수행하고 jrxml 파일에 하드 코딩 할 필요가 없습니다. 감사합니다

+0

예를 들어 (JasperReports API) [http://jasperreports.sourceforge.net/api/] 또는 [DynamicJasper API] (http://dynamicjasper.com/documentation-examples/api-docs/)를 사용할 수 있습니다 –

+0

첫 번째 링크가 죽은 것처럼 보입니다.이 작업을 수행 할 수있게 해주는 DynamicJasper API에 대해 구체적으로 설명 할 수 있습니까? 아마도 코드 예입니다. – Tyrick

답변

0

textFields에서 PrintWhenExpression을 설정하여 두 번째 방법을 사용하고이 textFields 속성에서 "Remove Line When Blank"체크 상자를 설정하십시오.

+0

한숨 .. 정말 다이내믹해야합니다 .. 특정 예제에서는 두 개의 textField가 있지만 실제로는 숫자가 될 수 있습니다 ... 요점은 모르겠지만 자동 크기 조정 방법이 필요합니다. 밴드 내가 textFields의 x 양을 넣을 때 – Tyrick

0

보고서가 JRDesign 동적으로 생성되어있는 경우는 사용하여 다음을 수행 할 수 있습니다

JRDesignBand band = (JRDesignBand) jasperDesign.getColumnFooter(); 
     JRDesignTextField textField = new JRDesignTextField(); 
     textField.setX(0); 
     textField.setY(0); 
     band.addElement(textField); 
0
내가 말할 죄송

하지만 난 그것을 통해 인쇄하도록 설계되었습니다 느낌있는 JR 자바 API 작업의 년 후 고정 된 레이아웃의 문서. 당신의 경우에 도움이 될 수있는 것 : 나타날 수있는 필드의 최대 개수를 알고 있다면 밴드에 모든 필드를 추가하고 각 필드에 대해 "빈 줄 때 제거"플래그를 true로 설정하십시오. 사용하지 않는 필드가 축소됩니다.

관련 문제