Jump to content
JasperReports Library 7.0 is now available ×

Another Subreport stretch problem.


2004 IR Help

Recommended Posts

By: Larcheveque - mcheit

Another Subreport stretch problem.

2005-01-21 02:19

 

Hello, I have a problem to format a text field in a pdf file. I launch a SQL query to retrieve a (or a group of) string (type longtext in MySQL) and I'd just like to adjust a subreport height to this result that can enclose several lines.

Apparently there are two options:

- using isStretchWithOverflow="true" in the textField attribute, but I couldn't make it work.

- using some potential blank textField that can disapear if empty (according to this thread

about a similare topic: http://sourceforge.net/forum/message.php?msg_id=1829050). I don't know to share SQL query result between two fields.

 

I would prefere not to use the second one if possible.

 

You can find my subreport code at the end of the message, sorry for the long copy/paste but I don't really know what I can remove without impacting on a potential solution.

 

Thx for any help.

Benjamin

 

ps: I am using iReport-0.4.0, jasperreports-0.6.4 and MySQL-4.1.8.

ps2: My Code

 

<?xml version="1.0" encoding="UTF-8" ?>

<!-- Created with iReport - A designer for JasperReports -->

<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

<jasperReport

name="test"

columnCount="1"

printOrder="Vertical"

orientation="Portrait"

pageWidth="535"

pageHeight="842"

columnWidth="535"

columnSpacing="0"

leftMargin="0"

rightMargin="0"

topMargin="0"

bottomMargin="0"

whenNoDataType="NoPages"

isTitleNewPage="false"

isSummaryNewPage="false">

<property name="ireport.scriptlethandling" value="2" />

<parameter name="id_collaborateurs" isForPrompting="false" class="java.lang.Integer">

<defaultValueExpression ><![CDATA[new Integer(16)]]></defaultValueExpression>

</parameter>

<queryString><![CDATA[sELECT

cvtheque_missions.titre,

cvtheque_missions.desc

FROM

cvtheque_missions

WHERE

cvtheque_missions.id_collaborateurs = $P{id_collaborateurs}]]></queryString>

<field name="titre" class="java.lang.String"/>

<field name="desc" class="java.lang.String"/>

<background>

<band height="0" isSplitAllowed="true" >

</band>

</background>

<title>

<band height="25" isSplitAllowed="true" >

<staticText>

<reportElement

mode="Opaque"

x="1"

y="1"

width="337"

height="20"

forecolor="#000000"

backcolor="#CCCCCC"

key="staticText-1"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<textElement textAlignment="Left" verticalAlignment="Middle" rotation="None" lineSpacing="Single">

<font fontName="Arial" pdfFontName="Helvetica-Bold" size="14" isBold="true" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

<text><![CDATA[DOMAINE DE COMPETENCES]]></text>

</staticText>

</band>

</title>

<pageHeader>

<band height="0" isSplitAllowed="true" >

</band>

</pageHeader>

<columnHeader>

<band height="0" isSplitAllowed="true" >

</band>

</columnHeader>

<detail>

<band height="150" isSplitAllowed="true" >

<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement

mode="Opaque"

x="156"

y="0"

width="374"

height="147"

forecolor="#000000"

backcolor="#FFFFFF"

key="textField-4"

stretchType="RelativeToBandHeight"

positionType="Float"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="true"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<textElement textAlignment="Justified" verticalAlignment="Top" rotation="None" lineSpacing="Single">

<font fontName="Arial" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA[$F{desc}]]></textFieldExpression>

</textField>

<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement

mode="Opaque"

x="3"

y="1"

width="150"

height="50"

forecolor="#000000"

backcolor="#FFFFFF"

key="textField-5"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" lineSpacing="Single">

<font fontName="Arial Black" pdfFontName="Helvetica-Bold" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA[$F{titre} + " :"]]></textFieldExpression>

</textField>

</band>

</detail>

<columnFooter>

<band height="0" isSplitAllowed="true" >

</band>

</columnFooter>

<pageFooter>

<band height="0" isSplitAllowed="true" >

</band>

</pageFooter>

<summary>

<band height="0" isSplitAllowed="true" >

</band>

</summary>

</jasperReport>

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...