Jump to content
Changes to the Jaspersoft community edition download ×

how to use a java imported class in report


flamant

Recommended Posts

Hi,

I have a report with special caracters

when I generate the jrxml String it includes special characters and I get an error at line 2 (see the following)

(in jrxml, I have for example a static Text  "<text><![CDATA[" + field.getFldText() + "]]></text>" with special characters in field.getFldText())

line 1 - InputStream jrxmlInputStream = new ByteArrayInputStream(jrxml.toString().getBytes());

line 2 - JasperDesign jasperDesign = JRXmlLoader.load(jrxmlInputStream);

 

So, I try to escape special characters (xml escaping) the raw data ( field.getFldText() ) and to use an   imported class in jrxml to unescape back ( xml unescaping ) the data

<import value=\"org.apache.commons.lang.StringEscapeUtils\" /> under jasperReport tag

And for the static Text

<text><![CDATA[stringEscapeUtils.unescapeXml(").append(StringEscapeUtils.escapeXml(field.getFldText())).append(")]]></text>

 

But it seems that org.apache.commons.lang.StringEscapeUtils.unescapeXml() is not used as a java class but as a raw String (in jrxml, I can see the following: <text><![CDATA[stringEscapeUtils.unescapeXml(Do NOT use the following symbols: \ (backward slash), é, Ä, ß, µ (non-English language symbols), °C (superscripts), ¾ (fractions), symbols < and > and quotation marks)]]></text>

 

I conclude that I don't use the right way to use imported java class. Do you have an idea ?

 

Thank you in advance for your answers

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...