mardi 4 août 2015

Jasperreport barcode JRValidationException

I need to create jasperreport with barcode in table column & show when some parameter is true.

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


<frame>
 <reportElement uuid="1fc9fc94-0e14-4b98-9e20-ad68cad679c7" key="myField" positionType="Float" stretchType="RelativeToTallestObject" mode="Opaque" x="63" y="0" width="151" height="23" isPrintWhenDetailOverflows="true"/>
                    <box leftPadding="0" rightPadding="0">
                        <pen lineWidth="1.0"/>
                    </box>
                    <componentElement>
                        <reportElement uuid="8b98e4f1-a5ae-4453-bb76-3ee99704c183" key="myField" positionType="Float" x="0" y="2" width="151" height="18" isPrintWhenDetailOverflows="true">
                            <printWhenExpression><![CDATA[$P{needToPrint} == true]]></printWhenExpression>
                        </reportElement>
                        <jr:barbecue xmlns:jr="http://ift.tt/1cl9b3L" xsi:schemaLocation="http://ift.tt/1cl9b3L http://ift.tt/1cl9b3P" type="Code39 (Extended)" drawText="false" checksumRequired="false">
                            <jr:codeExpression><![CDATA[$F{myField}]]></jr:codeExpression>
                        </jr:barbecue>
                </componentElement>
            </frame>

When i try to print it, I have

net.sf.jasperreports.engine.design.JRValidationException: Report design not valid : 
     1. Element reaches outside frame width: x=0, width=151, available width=69.

But only if column width on UI less than some value (less, not greater). Frame paddings = 0. I also trying to set x="0" - it doesn't help. In jasper src it fails here:

if (element.getX() + element.getWidth() > avlblWidth)
where int avlblWidth = frame.getWidth() - leftPadding - rightPadding;
element form frame.getElements();

I would be grateful for any help

Aucun commentaire:

Enregistrer un commentaire