How to set width of reportElement element using property expression in Jasper reports

<reportElement x="79" y="103" width="279" height="23" backcolor="#000000">
    <propertyExpression name="width"><![CDATA["100"]]></propertyExpression>
</reportElement>

I am trying to set the width of reportElement using propertyExpresssion , JasperReports picks the width as 279 instead of 100 in the above code, and if I remove the width attribute in the reportElement tag . I get an error message.

What am I doing wrong? It compiles, fills everything, but the width is not used in the expression.

+3
source share
3 answers
JRElement element = jasperReport.getTitle().getElementByKey("graphWidthKey");
element.setWidth(100);
0
source

100 reportElement, , , . , , .

0

propertyExpressionmay not be used to set the width , which is attribute. They are used to add a property, for example, during export, or to pass a value toChartCustomizer

These are the available properties for configuring the jasper report property.

A typical property would be

<property name="net.sf.jasperreports.export.xls.break.after.row" value="true"/>

And you can create propertyExpressionfor this:

<propertyExpression name="net.sf.jasperreports.export.xls.break.after.row"><![CDATA[$V{timeToBreak}?"true":"false"]]></propertyExpression>
0
source

Source: https://habr.com/ru/post/1719836/


All Articles