fanethemighty Posted June 20, 2013 Share Posted June 20, 2013 Hi!I'm trying to create a simple grouping of rows like on the following image:That is I have a simple bean with fields "group" and "detail"; grouping is done by the "group" field values. In the detail band, I would liked rows grouped by the "group" field and the group valued aligned with middle vertical alignment. For this I have created a simple report using iReport like in the next picture (everything is in the detail band)I have investigated several possibilities for defining the first textfield, but none of them successful. Here are some options for the textfiled containing $F{Group} and their respective outputs.A. Print Repeated values=false, Position Type=Fix Relative to Bottom, Stretch Type=Relative to Band Height, Evaluation Time=Band (from docs: BAND The element will be evaluated at band end.BAND)Result can be seen in the next picture.B. Print Repeated values=true, Position Type=Fix Relative to Bottom, Stretch Type=Relative to Band Height, Evaluation Time=BandResult: the same as previousC. Print Repeated values=true, Position Type=Fix Relative to Bottom, Stretch Type=Relative to Band Height, Evaluation Time=Band, Print When Group Changes=groupResult: the same as previousD. Print Repeated values=false, Position Type=Fix Relative to Bottom, Stretch Type=Relative to Band Height, Evaluation Time=Now, Print When Group Changes=groupResult: the same as previousE. Print Repeated values=false, Position Type=Fix Relative to Bottom, Stretch Type=Relative to Band Height, Evaluation Time=Group, Evaluation Group=group, Print When Group Changes=nullResult: the same as previousF. Print Repeated values=false, Position Type=Fix Relative to Bottom, Stretch Type=Relative to Band Height, Evaluation Time=Group, Evaluation Group=group, Print When Group Changes=groupResult: the same as previous So, as you see, no real luck.Here is the attached source for the report.<?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="TestBandHeight" language="groovy" 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"/> <queryString> <![CDATA[]]> </queryString> <field name="Group" class="java.lang.String"/> <field name="Detail" class="java.lang.String"/> <group name="group"> <groupExpression><![CDATA[$F{Group}]]></groupExpression> </group> <detail> <band height="28" splitType="Stretch"> <textField isStretchWithOverflow="true" evaluationTime="Group" evaluationGroup="group"> <reportElement positionType="FixRelativeToBottom" stretchType="RelativeToBandHeight" isPrintRepeatedValues="false" mode="Opaque" x="114" y="0" width="100" height="28" printWhenGroupChanges="group" backcolor="#FFCC00"/> <textElement textAlignment="Center" verticalAlignment="Middle"/> <textFieldExpression><![CDATA[$F{Group}]]></textFieldExpression> </textField> <textField> <reportElement mode="Opaque" x="214" y="0" width="100" height="28" backcolor="#00CCCC"/> <textElement textAlignment="Center" verticalAlignment="Middle"/> <textFieldExpression><![CDATA[$F{Detail}]]></textFieldExpression> </textField> </band> </detail></jasperReport>[/code] Here is the same question, unfortunately with no response:http://community.jaspersoft.com/questions/540767/stretching-non-overflowing-text-field-detail-bandThank you. Link to comment Share on other sites More sharing options...
Thomas Zimmer Posted June 20, 2013 Share Posted June 20, 2013 It is not possible to vertical align a text in a text filed over multiple details. For a bunch of good reasons.What you could do, is group the report by your column a, place a stretching text field. Then you could use a subreport, table or list to show the lines belonging to that group.Possibly using a crosstab would be a solution, too.Cheers, Thomashttp://www.thomaszimmer.net Link to comment Share on other sites More sharing options...
fanethemighty Posted June 21, 2013 Author Share Posted June 21, 2013 Thank you for the answer, makes things clear. I guess a crosstab is more suited in this case. Link to comment Share on other sites More sharing options...
j2eealidev Posted November 18, 2017 Share Posted November 18, 2017 Hello Thomas, Of course using crosstab will resolve his problem so quickly, i want your advice about changing to : a1 a2 a b1 b2 b is it possible to make this in crosstab in right direction ? thank you 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