开发者

How can I set the width of a reportElement using propertyExpression in Jasper Reports

<reportElement x="79" y="103" width="279" height="23" backcolor="#000000">
    <propertyExpression name="width"><![CDAT开发者_如何转开发A["100"]]></propertyExpression>
</reportElement>

I am trying to set the width of a reportElement by using a propertyExpresssion, JasperReports is picking up the width as 279 instead of 100 in the code above, and if I remove the width attribute in the reportElement tag I will get an error.

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


JRElement element = jasperReport.getTitle().getElementByKey("graphWidthKey");
element.setWidth(100);


why not directly set 100 at reportElement tag, and i doubt whether is a solution to have width of text inside a box different of the box width. if you know, please share.


propertyExpression can not be used to set width that is an attribute. They are used to add property's for example during export or to pass value to a ChartCustomizer

These are the available properties for configuration jasper report properties

A typical property would be

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

And you can create a propertyExpression for this:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜