jl_3 Posted April 22, 2016 Share Posted April 22, 2016 Hello, I got a problem trying to print comments in my report.Comment are stored in my ORACLE base in a table text_comment in a column where type is a varchar2.Those comments are stored using more than one line.exemple of data :INDICE | TEXTE 1 | TOTO/n 2 | TUTUSo, when I concat my comments i can get something too big for a varchar (more than 4000 char)In my report Comments are not my details, for each details I have many comments so I concat them.I manage to concat my comments in one bloc using CLOB. Using this method : SELECT[...]DBMS_XMLGEN.CONVERT(EXTRACT(xmltype('<?xml version="1.0"?><document>'||XMLAGG(XMLTYPE('<V>'|| DBMS_XMLGEN.CONVERT(COMMENTAIRE_TEXTE_FOOTER.COTE_TEXTE)|| ' </V>') ORDER BY COMMENTAIRE_TEXTE_FOOTER.COTE_INDICE).getclobval()||'</document>'), '/document/V/text()') .getclobval(),1) AS COMMENTAIRE_FOOTER[...]FROM [...] COMMENTAIRE_TEXTE_FOOTER [...]With this I get a oracle.jdbc.internal.OracleClob object for Ireport.Using iReport Designer 5.6.0 I read the CLOB Object like this : new BufferedReader(new InputStreamReader(((oracle.jdbc.internal.OracleClob)$F{COMMENTAIRE_FOOTER}).binaryStreamValue())).readLine();My problem is that when i get my concatened comment, it came as a one line comment. Exemple : TOTO/nTUTUBut I want :TOTOTUTUIs there a way to keep my line separators throught all the data conversion ?Jérôme Link to comment Share on other sites More sharing options...
marianol Posted April 25, 2016 Share Posted April 25, 2016 That is because you have /n and your line separator may be different check System.getProperty("line.separator")In this cases I prefer to use styled test. You can do this, replce the "/n" with breaks <br>:myText.replace("n", "<br>");And then In the properties window of the text Field select "html" in the “Markup” drop down (see screenshot below). Also remember to select "Stretch with Overflow" so the txt field will stretch when the text is long.These are the markup options you have for your reference, check the JasperReports Doc Samples:none - The content of the text element is plain text. There is nothing to be processed. This is the default value.styled - The content of the text element is styled text, the JasperReports proprietary XML type of markup text. It overrides the deprecated isStyledText attribute. (See the Styled text sample)html - The content of the text element is Hyper Text Markup Languagertf - The content of the text element is Rich Text Format Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now