How to modify a <staticText> element in a JasperReport
I've an xml that I restore from my Data base containing jasperreports. Here's an excerpt:
<staticText>......<text><![CDATA[Entidad Bancaria:]]></text></staticText>
I want to programatically substitute the content of the CDATA element and then regenerate the JasperReport, but I found that the API doesn't allow to d开发者_开发问答o this (or it's too difficult to figure out how). So I tried to convert the jasper xml into a string, from string to Inputstream (to match the signature of JasperFillManager.fillReport() method), but the compile fails... Does anyone know how to accomplish this in a correct way? Thanks!
Static text isn't made to be changed programmatically. Why not just change the staticText
to a textField
and then use a parameter? Change the xml to:
<textField><textFieldExpression><![CDATA[$P{banc}]]></textFieldExpression></textField>
Then set the value of banc
programatically and pass it to fillReport()
精彩评论