2010-09-07 54 views
6

es mi código jrxml:¿Cómo eliminar espacio extra entre filas en JasperReports?

<?xml version="1.0" encoding="UTF-8"?> 
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="example_report" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20"> 
    <property name="ireport.zoom" value="1.0"/> 
    <property name="ireport.x" value="0"/> 
    <property name="ireport.y" value="0"/> 
    <field name="name" class="java.lang.String"/> 
    <field name="test" class="java.lang.String"/> 
    <field name="price" class="java.lang.Double"/> 
    <background> 
     <band splitType="Stretch"/> 
    </background> 
    <title> 
     <band height="79" splitType="Stretch"/> 
    </title> 
    <pageHeader> 
     <band height="35" splitType="Stretch"/> 
    </pageHeader> 
    <columnHeader> 
     <band height="61" splitType="Stretch"/> 
    </columnHeader> 
    <detail> 
     <band height="125" splitType="Stretch"> 
      <textField> 
       <reportElement stretchType="RelativeToBandHeight" x="0" y="0" width="209" height="20"/> 
       <textElement/> 
       <textFieldExpression class="java.lang.String"><![CDATA[$F{name}]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement x="209" y="0" width="201" height="20"/> 
       <textElement/> 
       <textFieldExpression class="java.lang.String"><![CDATA[$F{test}]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement x="410" y="0" width="145" height="20"/> 
       <textElement/> 
       <textFieldExpression class="java.lang.Double"><![CDATA[$F{price}]]></textFieldExpression> 
      </textField> 
     </band> 
    </detail> 
    <columnFooter> 
     <band height="45" splitType="Stretch"/> 
    </columnFooter> 
    <pageFooter> 
     <band height="54" splitType="Stretch"/> 
    </pageFooter> 
    <summary> 
     <band height="42" splitType="Stretch"/> 
    </summary> 
</jasperReport> 

Cuando agrego colección de datos en el informe compilado en mi aplicacion consigo espacio adicional entre filas. Cómo eliminar este espacio extra?

Respuesta

10

creo que es porque se declara 125px para cada fila:

<detail> 
    <band height="125" splitType="Stretch"> 

pero sólo utiliza 20 píxeles de eso:

<reportElement stretchType="RelativeToBandHeight" x="0" y="0" width="209" height="20"/> 

tratar de hacer banda de detalle como la altura y cuando se utiliza (20 píxeles) :

<detail> 
    <band height="20" splitType="Stretch"> 

No estoy seguro, porque no usé Jasper durante unos meses, pero prueba esto.

Cuestiones relacionadas