senthilkrishnan92 Posted February 7, 2019 Share Posted February 7, 2019 I'm new to jasper reports and working with Jaspersoft ireport designer 4.7.0.I want to create a table with 3 columns and each cell in the table needs to be stretched to the largest object of the datasource.PFB the jrxml code. I have tried with changing the properties of text element Position-float;stretch with overflow - true,Stretch type - relative to tallest object but it works for one row only.I want this to effective for all cells of the table.I have googled a lot for last couple of days and nothing works for me.Please help how this can be implemented with jasper reports.Kindly help to achieve this.<?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="report3" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="f32dfce1-c0d4-4f20-b896-653e7497d7ba"> <property name="ireport.zoom" value="1.0"/> <property name="ireport.x" value="0"/> <property name="ireport.y" value="0"/> <style name="table"> <box> <pen lineWidth="1.0" lineColor="#000000"/> </box> </style> <style name="table_TH" mode="Opaque" backcolor="#F0F8FF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="table_CH" mode="Opaque" backcolor="#BFE1FF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="table_TD" mode="Opaque" backcolor="#FFFFFF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> </box> </style> <subDataset name="tabeDataSet" uuid="46e73a3d-e883-4c74-a062-6984cc6dac58"> <field name="id" class="java.lang.String"/> <field name="city" class="java.lang.String"/> <field name="street" class="java.lang.String"/> </subDataset> <subDataset name="Table Dataset 1" uuid="4a76bbab-d785-49f2-82aa-705ea0a2e0d1"/> <subDataset name="Table Dataset 2" uuid="984926ca-9b74-4713-a4a8-25e7e3a32697"/> <parameter name="tableData" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"/> <parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false"> <defaultValueExpression><![CDATA["C:\Users\1598251\git\jasper-reports-samples\reports\"]]></defaultValueExpression> </parameter> <field name="field1" class="java.lang.String"/> <detail> <band height="137"> <componentElement> <reportElement uuid="15c3dd87-c15b-4a13-ad39-18c838b85bd8" key="table 1" x="84" y="38" width="360" 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="tabeDataSet" uuid="59c31172-6ec3-4470-9424-2decd85c7e82"> <dataSourceExpression><![CDATA[$P{tableData}]]></dataSourceExpression> </datasetRun> <jr:column uuid="d9f154db-e16f-47ae-9f8d-fdaa83499a44" width="90"> <jr:detailCell height="20"> <box> <pen lineWidth="0.5"/> <topPen lineWidth="0.5"/> <leftPen lineWidth="0.5"/> <bottomPen lineWidth="0.5"/> <rightPen lineWidth="0.5"/> </box> <textField isStretchWithOverflow="true"> <reportElement uuid="cb5d51fd-c93e-4d37-9e22-f1a78922aed4" stretchType="RelativeToTallestObject" x="0" y="0" width="90" height="20"/> <textElement/> <textFieldExpression><![CDATA[$F{id}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column uuid="c13f33dc-75d3-4e04-885b-5dba242012ca" width="90"> <jr:detailCell height="20"> <box> <pen lineWidth="0.5"/> <topPen lineWidth="0.5"/> <leftPen lineWidth="0.5"/> <bottomPen lineWidth="0.5"/> <rightPen lineWidth="0.5"/> </box> <textField isStretchWithOverflow="true"> <reportElement uuid="0850fdb9-8210-408b-a288-8657e754522d" stretchType="RelativeToTallestObject" x="0" y="0" width="90" height="20"/> <textElement/> <textFieldExpression><![CDATA[$F{city}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column uuid="8f29db90-d504-48fa-b93d-7e214bb6eb12" width="90"> <jr:detailCell height="20"> <box> <pen lineWidth="0.5"/> <topPen lineWidth="0.5"/> <leftPen lineWidth="0.5"/> <bottomPen lineWidth="0.5"/> <rightPen lineWidth="0.5"/> </box> <textField isStretchWithOverflow="true"> <reportElement uuid="f0d67538-ae5c-4a5d-964c-408341182391" stretchType="RelativeToTallestObject" x="0" y="0" width="90" height="20"/> <textElement/> <textFieldExpression><![CDATA[$F{street}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> </jr:table> </componentElement> </band> </detail></jasperReport>[/code]Current:IDCityStreet1ChennaiKarappakam, Old Mahabalipuram Road, Karapakkam2BangaloreBanaswadi I want the second row also to be as of same height of the first row i.e highest object of the table.Please help. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now