2013-01-17 87 views
1

我的問題是,我怎麼可以設置爲表尾列列跨度價值iReport的,在JRXML文件。如何設置表格colspan?

我必須用iReport來輕鬆創建我的PDF設計。我通過Tomcat發送字段和參數值PHP。我不使用Java創建動態碧玉報告。

這意味着我必須從jrxml來解決我的問題。

是否可以做到這一點? XML的

+0

'這意味着我必須從jrxml.'解決我的問題 - 什麼是你的問題? –

+0

我無法解決我的問題 - 我如何設置表頁腳單元格的colspan - 在Java中,因爲我使用PHP來收集參數和字段。唯一的方法來修改XML,但我沒有找到任何解決方案。 – aBanhidy

+0

你的目標設計是什麼?您可以爲* textField *元素(或任何其他)設置任何寬度, –

回答

2

您不能像這樣做colspan,但可以將iReport中的表格列分組(在表格頁腳中選擇多個列)。然後刪除頁腳中各個列的單元格,併爲頁腳中的「組頁眉」添加一個單元格。 所有純粹的iReport/JRXML。

iReport Inspector for grouped table footer

0

詳細部分:

<detail> 
    <band height="43" splitType="Stretch"> 
     <textField> 
      <reportElement x="0" y="0" width="344" height="20"/> 
      <box> 
       <bottomPen lineWidth="0.5"/> 
      </box> 
      <textElement verticalAlignment="Middle"> 
       <font isBold="true"/> 
      </textElement> 
      <textFieldExpression class="java.lang.String"><![CDATA[$F{data_title}]]></textFieldExpression> 
     </textField> 
     <componentElement> 
      <reportElement key="table" x="0" y="20" width="802" height="20"/> 
      <jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd"> 
       <datasetRun subDataset="details"> 
        <datasetParameter name="credit"> 
         <datasetParameterExpression><![CDATA[$F{credit}]]></datasetParameterExpression> 
        </datasetParameter> 
        <datasetParameter name="debit_gross_sum"> 
         <datasetParameterExpression><![CDATA[$F{debit_gross_sum}]]></datasetParameterExpression> 
        </datasetParameter> 
        <datasetParameter name="debit_net_sum"> 
         <datasetParameterExpression><![CDATA[$F{debit_net_sum}]]></datasetParameterExpression> 
        </datasetParameter> 
        <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRMapCollectionDataSource($F{details})]]></dataSourceExpression> 
       </datasetRun> 
       <jr:column width="12"> 
        <jr:tableFooter height="15" rowSpan="1"/> 
        <jr:detailCell height="20" rowSpan="1"/> 
       </jr:column> 
       <jr:column width="48"> 
        <jr:tableFooter height="15" rowSpan="1"/> 
        <jr:detailCell height="20" rowSpan="1"> 
         <textField isBlankWhenNull="true"> 
          <reportElement x="0" y="0" width="48" height="20"/> 
          <textElement> 
           <font pdfEncoding="Cp1250"/> 
          </textElement> 
          <textFieldExpression class="java.lang.String"><![CDATA[$F{time}]]></textFieldExpression> 
         </textField> 
        </jr:detailCell> 
       </jr:column> 
       <jr:column width="106"> 
        <jr:tableFooter height="15" rowSpan="1"/> 
        <jr:detailCell height="20" rowSpan="1"> 
         <textField isBlankWhenNull="true"> 
          <reportElement x="0" y="0" width="106" height="20"/> 
          <textElement> 
           <font pdfEncoding="Cp1250"/> 
          </textElement> 
          <textFieldExpression class="java.lang.String"><![CDATA[$F{description}]]></textFieldExpression> 
         </textField> 
        </jr:detailCell> 
       </jr:column> 
       <jr:column width="130"> 
        <jr:tableFooter height="15" rowSpan="1"> 
         <textField isBlankWhenNull="true"> 
          <reportElement x="0" y="0" width="130" height="15"/> 
          <box> 
           <bottomPen lineWidth="0.5"/> 
          </box> 
          <textElement> 
           <font pdfEncoding="Cp1250"/> 
          </textElement> 
          <textFieldExpression class="java.lang.String"><![CDATA[""]]></textFieldExpression> 
         </textField> 
        </jr:tableFooter> 
        <jr:detailCell height="20" rowSpan="1"> 
         <textField isBlankWhenNull="true"> 
          <reportElement x="0" y="0" width="130" height="20"/> 
          <textElement> 
           <font pdfEncoding="Cp1250"/> 
          </textElement> 
          <textFieldExpression class="java.lang.String"><![CDATA[$F{guest_name}]]></textFieldExpression> 
         </textField> 
        </jr:detailCell> 
       </jr:column> 
       <jr:column width="48"> 
        <jr:tableFooter height="15" rowSpan="1"> 
         <textField isBlankWhenNull="true"> 
          <reportElement x="0" y="0" width="48" height="15"/> 
          <box> 
           <bottomPen lineWidth="0.5"/> 
          </box> 
          <textElement> 
           <font pdfEncoding="Cp1250"/> 
          </textElement> 
          <textFieldExpression class="java.lang.String"><![CDATA[""]]></textFieldExpression> 
         </textField> 
        </jr:tableFooter> 
        <jr:detailCell height="20" rowSpan="1"> 
         <textField isBlankWhenNull="true"> 
          <reportElement x="0" y="0" width="48" height="20"/> 
          <textElement> 
           <font pdfEncoding="Cp1250"/> 
          </textElement> 
          <textFieldExpression class="java.lang.String"><![CDATA[$F{room}]]></textFieldExpression> 
         </textField> 
        </jr:detailCell> 
       </jr:column> 
       <jr:column width="79"> 
        <jr:tableFooter height="15" rowSpan="1"> 
         <textField isBlankWhenNull="true"> 
          <reportElement x="0" y="0" width="79" height="15"/> 
          <box> 
           <bottomPen lineWidth="0.5"/> 
          </box> 
          <textElement> 
           <font pdfEncoding="Cp1250"/> 
          </textElement> 
          <textFieldExpression class="java.lang.String"><![CDATA[""]]></textFieldExpression> 
         </textField> 
        </jr:tableFooter> 
        <jr:detailCell height="20" rowSpan="1"> 
         <textField isBlankWhenNull="true"> 
          <reportElement x="0" y="0" width="79" height="20"/> 
          <textElement> 
           <font pdfEncoding="Cp1250"/> 
          </textElement> 
          <textFieldExpression class="java.lang.String"><![CDATA[$F{cachier_user}]]></textFieldExpression> 
         </textField> 
        </jr:detailCell> 
       </jr:column> 
       <jr:column width="77"> 
        <jr:tableFooter height="15" rowSpan="1"> 
         <textField isBlankWhenNull="true"> 
          <reportElement x="0" y="0" width="77" height="15"/> 
          <box> 
           <bottomPen lineWidth="0.5"/> 
          </box> 
          <textElement> 
           <font pdfEncoding="Cp1250"/> 
          </textElement> 
          <textFieldExpression class="java.lang.String"><![CDATA[""]]></textFieldExpression> 
         </textField> 
        </jr:tableFooter> 
        <jr:detailCell height="20" rowSpan="1"> 
         <textField isBlankWhenNull="true"> 
          <reportElement x="0" y="0" width="77" height="20"/> 
          <textElement> 
           <font pdfEncoding="Cp1250"/> 
          </textElement> 
          <textFieldExpression class="java.lang.String"><![CDATA[$F{source_room}]]></textFieldExpression> 
         </textField> 
        </jr:detailCell> 
       </jr:column> 
       <jr:column width="126"> 
        <jr:tableFooter height="15" rowSpan="1"> 
         <textField isBlankWhenNull="true"> 
          <reportElement x="0" y="0" width="126" height="15"/> 
          <box> 
           <bottomPen lineWidth="0.5"/> 
          </box> 
          <textElement> 
           <font pdfEncoding="Cp1250"/> 
          </textElement> 
          <textFieldExpression class="java.lang.String"><![CDATA[""]]></textFieldExpression> 
         </textField> 
        </jr:tableFooter> 
        <jr:detailCell height="20" rowSpan="1"> 
         <textField isBlankWhenNull="true"> 
          <reportElement x="0" y="0" width="126" height="20"/> 
          <textElement> 
           <font pdfEncoding="Cp1250"/> 
          </textElement> 
          <textFieldExpression class="java.lang.String"><![CDATA[$F{source_guest_name}]]></textFieldExpression> 
         </textField> 
        </jr:detailCell> 
       </jr:column> 
       <jr:column width="70"> 
        <jr:tableFooter height="15" rowSpan="1"> 
         <textField isBlankWhenNull="true"> 
          <reportElement x="0" y="0" width="70" height="15"/> 
          <box rightPadding="0"> 
           <topPen lineWidth="0.5"/> 
           <bottomPen lineWidth="0.5"/> 
          </box> 
          <textElement textAlignment="Right"> 
           <font pdfEncoding="Cp1250"/> 
          </textElement> 
          <textFieldExpression class="java.lang.String"><![CDATA[$P{debit_gross_sum}]]></textFieldExpression> 
         </textField> 
        </jr:tableFooter> 
        <jr:detailCell height="20" rowSpan="1"> 
         <textField isBlankWhenNull="true"> 
          <reportElement x="0" y="0" width="70" height="20"/> 
          <textElement textAlignment="Right"> 
           <font pdfEncoding="Cp1250"/> 
          </textElement> 
          <textFieldExpression class="java.lang.String"><![CDATA[$F{debit_gross}]]></textFieldExpression> 
         </textField> 
        </jr:detailCell> 
       </jr:column> 
       <jr:column width="70"> 
        <jr:tableFooter height="15" rowSpan="1"> 
         <textField isBlankWhenNull="true"> 
          <reportElement x="0" y="0" width="70" height="15"/> 
          <box rightPadding="0"> 
           <topPen lineWidth="0.5"/> 
           <bottomPen lineWidth="0.5"/> 
          </box> 
          <textElement textAlignment="Right"> 
           <font pdfEncoding="Cp1250"/> 
          </textElement> 
          <textFieldExpression class="java.lang.String"><![CDATA[$P{debit_net_sum}]]></textFieldExpression> 
         </textField> 
        </jr:tableFooter> 
        <jr:detailCell height="20" rowSpan="1"> 
         <textField isBlankWhenNull="true"> 
          <reportElement x="0" y="0" width="70" height="20"/> 
          <textElement textAlignment="Right"> 
           <font pdfEncoding="Cp1250"/> 
          </textElement> 
          <textFieldExpression class="java.lang.String"><![CDATA[$F{debit_net}]]></textFieldExpression> 
         </textField> 
        </jr:detailCell> 
       </jr:column> 
       <jr:column width="37"> 
        <jr:tableFooter height="15" rowSpan="1"> 
         <textField isBlankWhenNull="true"> 
          <reportElement x="0" y="0" width="37" height="15"/> 
          <box> 
           <topPen lineWidth="0.5"/> 
           <bottomPen lineWidth="0.5"/> 
          </box> 
          <textElement textAlignment="Right" verticalAlignment="Top"> 
           <font pdfEncoding="Cp1250"/> 
          </textElement> 
          <textFieldExpression class="java.lang.String"><![CDATA[$P{credit}]]></textFieldExpression> 
         </textField> 
        </jr:tableFooter> 
        <jr:detailCell height="20" rowSpan="1"/> 
       </jr:column> 
      </jr:table> 
     </componentElement> 
    </band> 
</detail> 

我想從tableFotter 3.細胞4個細胞收起來。

謝謝Alex K!

相關問題