text fields in PDF report with trailing characters

12 Dec '13, 02:23 PM
7,218 Views
Forum Forum Starter - Level 3

Hi, I modeled a basic report according to the "Modeling Reports" article in the knowledge base, upon the entity "Person" in my project.

I obtain the pdf report, but the java.lang.String fields seem to be preceded (and followed) by trailing unwanted characters, such as "CR" and "TAB" which are not in the database: as a result, the string is shown in the second row, not at the beginning. When I define the text field FamilyName as "<"+$F{familyName}+">" in my PDF report I have something like this:

<
    Alighieri
>

The same happens when the output format is RTF. Of course, I may trim them out, but this would be a patch, not the solution. I walked through lots of options in iReport, but I was not able to find which are useful.

WebRatio version is 7.2.0, and iReport is 4.0.1 as recommended.

Someone had a similar issue?

 
x 1
Follow
Answer Answer at this question and get points!
Forum Starter - Level 2

Hi, the solution might be simple. You must escape the "<" and ">" characters. Jasper Reports (iReports) are defined in an XML file format, called JRXML. Therefore, you must escape any of the following characters:

 

"   &quot;
'   &apos;
<   &lt;
>   &gt;
&   &amp;

Good luck and keep us updated about the result.

 
x 0
Forum Starter - Level 3

Hi Laurentiu, please note that in the database I have exactly "Alighieri", and in iReport I defined the text field as "<"+$F{familyName}+">" just as a test to see the non-printable characters. In the final report, I set the text field as $F{familyName}, but will I have "Alighieri" written in three rows because it will contain "{CR}{TAB}Alighieri{CR}"

 
x 0
Forum Starter - Level 3

I solved the problem simply selecting each field, and setting the "Markup" property in the property window to "html", instead of "none". This works, and this means that  the field value was extracted and passed with HTML tags or characters that should be stripped off.

Sorry for my late explaination.

 
x 0
Answer at this question and get points!