Table Data with wrong Height using Lists

Hello, I have been encountering a problem on my report, as I export it to PDF the table middle column start to act a bit strange:

Image of the rendered PDF:

How it should be acting (image exemple):

Instead of turning the middle datas into single line, I wanted them to have the height increased to the registers that they are related to.

Also, I have been trying to implement Lists since all the information is nested, here is my .jrxml:

<?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="reportPorIncidencia" pageWidth="792" pageHeight="612" orientation="Landscape" whenNoDataType="AllSectionsNoDetail" columnWidth="752" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="b1e50698-2d92-4e90-81e8-02b837022198">
 
<property name="ireport.zoom" value="1.0"/>
 
<property name="ireport.x" value="0"/>
 
<property name="ireport.y" value="0"/>
 
<style name="TABLE_TD" hAlign="Center" vAlign="Middle">
 
<box>
 
<pen lineWidth="1.0" lineColor="#000000"/>
 
<topPen lineWidth="1.0" lineColor="#000000"/>
 
<leftPen lineWidth="1.0" lineColor="#000000"/>
 
<bottomPen lineWidth="1.0" lineColor="#000000"/>
 
<rightPen lineWidth="1.0" lineColor="#000000"/>
 
</box>
 
</style>
 
<style name="TABLE_TH" mode="Opaque" forecolor="#FFFFFF" backcolor="#99CCFF" fill="Solid" hAlign="Center" vAlign="Middle">
 
<box>
 
<pen lineWidth="1.0" lineColor="#000000"/>
 
<topPen lineWidth="1.0" lineColor="#000000"/>
 
<leftPen lineWidth="1.0" lineColor="#000000"/>
 
<bottomPen lineWidth="1.0" lineColor="#000000"/>
 
<rightPen lineWidth="1.0" lineColor="#000000"/>
 
</box>
 
</style>
 
<subDataset name="Table Dataset 1" uuid="f20138f8-6edc-4f65-96f7-612541904937">
 
<field name="cdServico" class="java.lang.String"/>
 
<field name="dcServico" class="java.lang.String"/>
 
<field name="stServico" class="java.lang.String"/>
 
<field name="listaTributacaoServico" class="java.util.List"/>
 
</subDataset>
 
<subDataset name="dataset1" uuid="98248cc0-fa46-438b-ae63-0f2c88288771">
 
<field name="cdTributacao" class="java.lang.String"/>
 
<field name="listaSubtituloServico" class="java.util.List"/>
 
</subDataset>
 
<subDataset name="dataset2" uuid="1fbe41a4-1678-47a7-a806-7bede2532e8a">
 
<field name="cdSubtitulo" class="java.lang.Integer"/>
 
</subDataset>
 
<parameter name="SUBREPORT_DIR" class="java.lang.String"/>
 
<background>
 
<band splitType="Stretch"/>
 
</background>
 
<detail>
 
<band height="125" splitType="Stretch">
 
<componentElement>
 
<reportElement uuid="6f9b293e-ee2f-4356-944f-cef0258feb9f" x="0" y="0" width="752" height="125"/>
 
<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="Table Dataset 1" uuid="49c49ae4-f2bc-487e-a94c-5038155d5b35">
 
<dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}]]></dataSourceExpression>
 
</datasetRun>
 
<jr:column uuid="f1697dbf-301a-48df-940b-3f899a60c226" width="90">
 
<jr:tableHeader style="TABLE_TH" height="30" rowSpan="1">
 
<staticText>
 
<reportElement uuid="d2d7c616-f5da-49cb-97e8-09947b87d3f6" style="TABLE_TH" x="0" y="0" width="90" height="30"/>
 
<textElement/>
 
<text><![CDATA[Código de Serviço]]></text>
 
</staticText>
 
</jr:tableHeader>
 
<jr:detailCell height="30" rowSpan="1">
 
<textField>
 
<reportElement uuid="3780d96c-9a33-4a92-b716-a4a3111b8982" style="TABLE_TD" x="0" y="0" width="90" height="30"/>
 
<textElement/>
 
<textFieldExpression><![CDATA[$F{cdServico}]]></textFieldExpression>
 
</textField>
 
</jr:detailCell>
 
</jr:column>
 
<jr:column uuid="38c58748-db2d-472b-81cb-e6e24357f482" width="90">
 
<jr:tableHeader style="TABLE_TH" height="30" rowSpan="1">
 
<staticText>
 
<reportElement uuid="d2d7c616-f5da-49cb-97e8-09947b87d3f6" style="TABLE_TH" x="0" y="0" width="90" height="30"/>
 
<textElement/>
 
<text><![CDATA[Descrição]]></text>
 
</staticText>
 
</jr:tableHeader>
 
<jr:detailCell height="30" rowSpan="1">
 
<textField isBlankWhenNull="true">
 
<reportElement uuid="296fa255-0635-4ea1-9c99-0dbde6c16d71" style="TABLE_TD" x="0" y="0" width="90" height="30"/>
 
<textElement/>
 
<textFieldExpression><![CDATA[$F{dcServico}]]></textFieldExpression>
 
</textField>
 
</jr:detailCell>
 
</jr:column>
 
<jr:column uuid="0063425d-1a1e-41f1-8350-fcc1d2f5eaa6" width="90">
 
<jr:tableHeader style="TABLE_TH" height="30" rowSpan="1">
 
<staticText>
 
<reportElement uuid="d2d7c616-f5da-49cb-97e8-09947b87d3f6" style="TABLE_TH" x="0" y="0" width="90" height="30"/>
 
<textElement/>
 
<text><![CDATA[Status]]></text>
 
</staticText>
 
</jr:tableHeader>
 
<jr:detailCell height="30" rowSpan="1">
 
<textField isBlankWhenNull="true">
 
<reportElement uuid="6a9065e9-df29-4366-89bf-94da95993acf" style="TABLE_TD" x="0" y="0" width="90" height="30"/>
 
<textElement/>
 
<textFieldExpression><![CDATA[$F{stServico}]]></textFieldExpression>
 
</textField>
 
</jr:detailCell>
 
</jr:column>
 
<jr:column uuid="14351c48-f8a6-481c-9b30-b8d5e6d1766b" width="90">
 
<jr:tableHeader style="TABLE_TH" height="30" rowSpan="1">
 
<staticText>
 
<reportElement uuid="d2d7c616-f5da-49cb-97e8-09947b87d3f6" style="TABLE_TH" x="0" y="0" width="90" height="30"/>
 
<textElement/>
 
<text><![CDATA[Código De Tributação]]></text>
 
</staticText>
 
</jr:tableHeader>
 
<jr:detailCell height="30" rowSpan="1">
 
<componentElement>
 
<reportElement uuid="2856c12b-df11-42eb-84b9-77abdb80b1cb" x="0" y="0" width="90" height="30"/>
 
<jr:list printOrder="Vertical">
 
<datasetRun subDataset="dataset1" uuid="6859e3a9-2182-4fb0-b669-79aeb4f782e3">
 
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{listaTributacaoServico})]]></dataSourceExpression>
 
</datasetRun>
 
<jr:listContents height="30" width="90">
 
<textField>
 
<reportElement uuid="8505ffb7-d1b4-4fdf-b244-1a8e155827e5" style="TABLE_TD" x="0" y="0" width="90" height="30"/>
 
<textElement/>
 
<textFieldExpression><![CDATA[$F{cdTributacao}]]></textFieldExpression>
 
</textField>
 
</jr:listContents>
 
</jr:list>
 
</componentElement>
 
</jr:detailCell>
 
</jr:column>
 
<jr:column uuid="f8f1e854-af6c-4b5f-944a-445d1f489ed8" width="90">
 
<jr:tableHeader style="TABLE_TH" height="30" rowSpan="1">
 
<staticText>
 
<reportElement uuid="d2d7c616-f5da-49cb-97e8-09947b87d3f6" style="TABLE_TH" x="0" y="0" width="90" height="30"/>
 
<textElement/>
 
<text><![CDATA[Subtitulo]]></text>
 
</staticText>
 
</jr:tableHeader>
 
<jr:detailCell style="TABLE_TD" height="30" rowSpan="1">
 
<componentElement>
 
<reportElement uuid="2856c12b-df11-42eb-84b9-77abdb80b1cb" x="0" y="0" width="90" height="30"/>
 
<jr:list printOrder="Vertical">
 
<datasetRun subDataset="dataset1" uuid="6859e3a9-2182-4fb0-b669-79aeb4f782e3">
 
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{listaTributacaoServico})]]></dataSourceExpression>
 
</datasetRun>
 
<jr:listContents height="30" width="90">
 
<componentElement>
 
<reportElement uuid="0139645b-b3f5-41e2-af83-857912835a67" x="0" y="0" width="90" height="30"/>
 
<jr:list printOrder="Vertical">
 
<datasetRun subDataset="dataset2" uuid="3f0f9121-9d89-4d6a-a1a9-70e9b1886b6b">
 
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{listaSubtituloServico})]]></dataSourceExpression>
 
</datasetRun>
 
<jr:listContents height="30" width="90">
 
<textField>
 
<reportElement uuid="8505ffb7-d1b4-4fdf-b244-1a8e155827e5" style="TABLE_TD" x="0" y="0" width="90" height="30"/>
 
<textElement/>
 
<textFieldExpression><![CDATA[$F{cdSubtitulo}]]></textFieldExpression>
 
</textField>
 
</jr:listContents>
 
</jr:list>
 
</componentElement>
 
</jr:listContents>
 
</jr:list>
 
</componentElement>
 
</jr:detailCell>
 
</jr:column>
 
</jr:table>
 
</componentElement>
 
</band>
 
</detail>
 
</jasperReport>

And here is my java code (not really that important really...):

String path = FacesContext.getCurrentInstance().getExternalContext().getRealPath("\\pages\\reports") + "\\";   
 
Map<String, Object> parametros = new HashMap<String, Object>();   
 
parametros.put("SUBREPORT_DIR", path);   
 
List<FooService> list = new ArrayList<FooService>();   
 
list.addAll(this.listFoo);   
 
list.add(0, new FooService());   
 
JasperReport jasperMasterReport = JasperCompileManager.compileReport(path+"reportFoo.jrxml");   
 
JasperPrint report = JasperFillManager.fillReport(     
 
jasperMasterReport,     
 
parametros, 
 
new JRBeanCollectionDataSource(list));   
 
File pdf = new File("reportFoo.pdf");   
 
FileOutputStream fos = new FileOutputStream(pdf);   
 
JasperExportManager.exportReportToPdfStream(report, fos);   
 
ExportUtil.sendPdf(pdf);

Could anyone help me with this?

Other information:

Jasper 5.1.0

XML done with iReports 4.7.1

Edit: I couldn't manage to use the code function, so I edited the text so it's better formatted

gabrielcompri's picture
Joined: Oct 26 2015 - 6:25am
Last seen: 7 years 11 months ago

0 Answers:

No answers yet
Feedback
randomness