andrey_nado Posted June 28, 2010 Share Posted June 28, 2010 Hi!I'm working with crosstabs and I have met following problem. My text fields in crosstab cells are using backcolor attribute together with mode="Opaque". I just want to colorize my data cells.In row header text field may contain long pieces of text which may be wrapped into several lines. Text field is stretched accordingly as well as corresponding crosstab rows.Now the problem: text fields in data cells are not stretched! I see it because only part of cell is filled by expected color.Code fragment is attached. Is there any workaround? Is this a bug and should I create issue in bugtracker?Regards,AndreyCode:<crosstab> <reportElement x="0" y="0" width="522" height="600"/> <crosstabParameter name="src" class="com.myproject.DataSource"> <parameterValueExpression><![CDATA[$P{src}]]></parameterValueExpression> </crosstabParameter> <crosstabDataset isDataPreSorted="true"> <dataset> <datasetRun subDataset="dataset1"> <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{src}.getData())]]></dataSourceExpression> </datasetRun> </dataset> </crosstabDataset> <rowGroup name="orderNo" width="102"> <bucket> <bucketExpression class="java.lang.Integer"><![CDATA[$F{orderNo}]]></bucketExpression> </bucket> <crosstabRowHeader> <cellContents> <textField isStretchWithOverflow="true"> <reportElement x="0" y="0" width="102" height="10" /> <textFieldExpression class="java.lang.String"><![CDATA[$P{src}.getEntryName($V{orderNo})]]></textFieldExpression> </textField> </cellContents> </crosstabRowHeader> <crosstabTotalRowHeader> <cellContents/> </crosstabTotalRowHeader> </rowGroup> <columnGroup name="field" height="10"> <bucket> <bucketExpression class="java.lang.String"><![CDATA[$F{field}]]></bucketExpression> </bucket> <crosstabColumnHeader> <cellContents> <textField> <reportElement x="0" y="0" width="30" height="10"/> <textFieldExpression class="java.lang.String"><![CDATA[$V{field}]]></textFieldExpression> </textField> </cellContents> </crosstabColumnHeader> <crosstabTotalColumnHeader> <cellContents/> </crosstabTotalColumnHeader> </columnGroup> <measure name="valueMeasure" class="java.lang.Double"> <measureExpression><![CDATA[$F{value}]]></measureExpression> </measure> <crosstabCell width="30" height="10"> <cellContents> <textField pattern="#0.00%" isBlankWhenNull="true"> <reportElement stretchType="RelativeToTallestObject" x="0" y="0" width="30" height="10" mode="Opaque" backcolor="#F0F0F0" /> <textFieldExpression class="java.lang.Double"><![CDATA[$V{valueMeasure}]]></textFieldExpression> </textField> </cellContents> </crosstabCell></crosstab> Link to comment Share on other sites More sharing options...
lucianc Posted July 2, 2010 Share Posted July 2, 2010 Set isStretchWithOverflow="true" for the text field in the data cell.Regards,Lucian 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