2006 IR Open Dicussion Posted August 27, 2006 Share Posted August 27, 2006 By: David Carrington - icewolf20 HTML tags not rendered when isStyledText set 2006-05-26 07:49Using jasperreports-1.0.0 Tried using jasperreports-1.2.2 I have a textField with a textFieldExpression passed in that contains HTML tags. I've set teh isStyledText="true" in the <textElement> tag: <textField isStretchWithOverflow="true"> <reportElement positionType="Float" mode="Opaque" x="0" y="0" width="468" height="88" forecolor="#333333"/> <textElement isStyledText="true"> <font fontName="Verdana" size="11"/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[$P{MainBody}]]></textFieldExpression> </textField> However, when I run the report (either through JasperAssistant, or through my servlet container, I get a PDF generated with any of the text wrapped in HTML tags completely removed. I tried upgrading to version 1.2.2 to see if it was a problem with 1.0.0, but with 1.2.2 it blows up in my face for no reason without a stacktrace. I've referenced the forums and the StyledTextReport.jrxml example, and I cannot find cause for this (or the blowup on fillReport, but that's another problem). According to the example, I shouold just be able to put direct HTML tags into a <text> field, so long as the isStyledText parameter is set to true. By: David Carrington - icewolf20 RE: HTML tags not rendered when isStyledText 2006-05-26 08:00As of right now...all I have is a single <b></b> tag...and according to the example, that should be supported. By: David Carrington - icewolf20 RE: HTML tags not rendered when isStyledText 2006-05-26 08:31Well, it would appear that it DOES work, but the tags are CASE SENSITIVE. I needed to do a regex replace on all capitalized HTML tags to lowercase. By: Teodor Danciu - teodord RE: HTML tags not rendered when isStyledText 2006-05-26 09:12 Hi, The case sensitive issue with HTML tags in styled text seems to be solved since JR 1.0.3. Are you sure you run against JR 1.2.2? Thanks, Teodor By: David Carrington - icewolf20 RE: HTML tags not rendered when isStyledText 2006-05-26 12:48I'm running JR 1.0.0...I, for some reason, cannot get 1.2.2 to work, it blows up without reason (or stacktrace) when I try to invoke fillReport. By: David Carrington - icewolf20 RE: HTML tags not rendered when isStyledText 2006-05-26 13:03On a related note, are there/have there been any external library requirement updates (not listed on the website)? I'm trying to run: JR 1.2.2 commons-digester 1.7 itext 1.02b poi 2.5.1 Does JR 1.2.2 require newer versions of commons/itext/poi? By: Lucian Chirita - lucianc RE: HTML tags not rendered when isStyledText 2006-05-29 01:15JR 1.2.2 additionally depends on Commons Javaflow. You can get a Javaflow snapshot jar from the JR package (or from the CVS, if you don't want to download the full JR project package). Regards, Lucian By: Teodor Danciu - teodord RE: HTML tags not rendered when isStyledText 2006-05-26 07:58 Hi, Only a limited subset of HTML tags are supported in styled text elements. More complex HTML containing tables or other advanced elements are not supporter. I hope this helps. Teodor By: kumar potla - kumarjasper RE: HTML tags not rendered when isStyledText 2006-06-05 08:28i am trying to use the below statement <detail> <band height="11"> <printWhenExpression><![CDATA[new Boolean($F{content} != null)]]></printWhenExpression> <textField isStretchWithOverflow="true"> <reportElement style="Text" positionType="Float" stretchType="RelativeToTallestObject" x="0" y="1" width="561" height="9" isRemoveLineWhenBlank="true"/> <textElement verticalAlignment="Middle" isStyledText="true"/> <textFieldExpression class="java.lang.String"><![CDATA[<b>$F{title} + ": "</b>+$F{content}.toString()]]></textFieldExpression> </textField> </band> </detail> unable to compile the above expression... is that HTML tag is nto identified or let me know hte reasonplease. Thanks. By: Lucian Chirita - lucianc RE: HTML tags not rendered when isStyledText 2006-06-09 10:16textFieldExpression has to be a valid Java expression (except the $X{..} placeholders), so you need something like "<b>" + $F{title} + ": </b>" + $F{content}.toString() HTH, Lucian By: kumar potla - kumarjasper RE: HTML tags not rendered when isStyledText 2006-08-03 09:17<detail> <band height="15"> <printWhenExpression><![CDATA[new Boolean($F{content} != null)]]></printWhenExpression> <textField isStretchWithOverflow="true" isBlankWhenNull="true"> <reportElement style="Text" positionType="Float" stretchType="RelativeToTallestObject" x="0" y="-2" width="561" height="15" isRemoveLineWhenBlank="true" isPrintWhenDetailOverflows="true"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA["<b>" +$F{title} + ": </b>"+$F{content}.toString()]]></textFieldExpression> </textField> </band> </detail> in the above code i am trying to use title in Bold and Content in normal Text. is that possible in Jasper..or am i missing any tags to perform the above operation By: Lucian Chirita - lucianc RE: HTML tags not rendered when isStyledText 2006-08-03 09:25You need to set isStyledText="true" for the text element. HTH, Lucian By: kumar potla - kumarjasper RE: HTML tags not rendered when isStyledText set 2006-06-12 09:48I tried the above statement "<b>" + $F{title} + ": </b>" + $F{content}.toString() now i am able to compile and run successfully,,but still the Title value doesn't showUp in BOLD...Do i need to add any jars or ? let me know Thanks. Kumar By: Lucian Chirita - lucianc RE: HTML tags not rendered when isStyledText 2006-06-13 01:18What kind of output are you producing (pdf, html, jasper viewer, etc)? Is the text bold in any of them? Have you checked the styled text sample here: http://jasperreports.sourceforge.net/samples/index.html ? By: kumar potla - kumarjasper RE: HTML tags not rendered when isStyledText set 2006-06-13 08:22I am trying to generate PDF.Yes i checked the StyledText sample. but i did not find using <b> </b> Tag in TextField Expression. <textFieldExpression class="java.lang.String"><![CDATA["<b>"+$F{title}+"</b>"+": "+$F{content}]]></textFieldExpression> In the above expression Title has to be Bold and Content has to be in normal Text.but all text is comming in non-Bold. am i doin wrong any where... or Bold Tag doesn't work in Text Field Expression. When i Check the The Preview with Empty DataSource it will show up in Bold. But when i actulaly generate PDF it doesn't show up in Bold. Thanks. By: Lucian Chirita - lucianc RE: HTML tags not rendered when isStyledText 2006-06-14 01:07To produce bold text in PDF you need to set a bold font for the text. There are two ways to do this with styled text: - use <style isBold="true" pdfFontName="bold font">text</style> instead of <b>text</b> - use <b>text</b> and register the bold PDF font at export time using the JRExporterParameter.FONT_MAP export parameter: fontMap.put(new FontKey("font name", true, false), new PdfFont("bold font name", "Cp1252", false)); You can see both approaches in the styled text sample (the report JRXML and the Java class where the export is performed). HTH, Lucian By: kumar potla - kumarjasper RE: HTML tags not rendered when isStyledText set 2006-06-14 15:01i was trying to use statement below <textField isStretchWithOverflow="true"> <reportElement style="Text" positionType="Float" stretchType="RelativeToTallestObject" x="0" y="1" width="561" height="9" isRemoveLineWhenBlank="true"/> <textElement isStyledText="true" textAlignment="Left"> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[<style isBold="true" pdfFontName="Helvetica-Bold">$F{title}</style> + ": " +$F{content}.toString()]]></textFieldExpression> </textField> Could not able to compile the statement. How to use <style> tag with in TextField Expression. I don't find any examples similar to that. Thanks. Kumar By: Lucian Chirita - lucianc RE: HTML tags not rendered when isStyledText 2006-06-15 00:33You're forgetting that textFieldExpression has to be a valid Java expression with $X{..} placeholders. Also, if you take a new look at the styled text sample, I'm sure you will find <style> tags in text field expressions. HTH, Lucian By: kumar potla - kumarjasper RE: HTML tags not rendered when isStyledText set 2006-08-03 09:19By: kumar potla - kumarjasper RE: HTML tags not rendered when isStyledText 2006-08-03 16:17 <detail> <band height="15"> <printWhenExpression><![CDATA[new Boolean($F{content} != null)]]></printWhenExpression> <textField isStretchWithOverflow="true" isBlankWhenNull="true"> <reportElement style="Text" positionType="Float" stretchType="RelativeToTallestObject" x="0" y="-2" width="561" height="15" isRemoveLineWhenBlank="true" isPrintWhenDetailOverflows="true"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA["<b>" +$F{title} + ": </b>"+$F{content}.toString()]]></textFieldExpression> </textField> </band> </detail> in the above code i am trying to use title in Bold and Content in normal Text. is that possible in Jasper..or am i missing any tags to perform the above operation Link to comment Share on other sites More sharing options...
jvpshyam Posted December 18, 2006 Share Posted December 18, 2006 hi alli am using iReports 1.2.0 version.I had a field in database that is embedded with html tags like<stron>,<p>,<table> etc..i exporting my report in RTF format.while exporting i couldn't convert these html tags .they were printing as it is..please help me to find out the solution..i want to render these tags and have effect on the information showing in the RTf format..and i made isSTyleCheck true also..but it has no effect..thanks ®ards...shyam :( Link to comment Share on other sites More sharing options...
jvpshyam Posted December 18, 2006 Share Posted December 18, 2006 hi alli am using JR 1.2.0.i have a field named as description in data base which contains normal text embedded with html tags like <strong>,<table>,<td>,<p> etc...i am JRRtfExporter to export my report in rtf format.My report is exporting succesfully but the text of decription is printing as it is along with html tags.The html tags have no effect on the text.I made isStyleCheck="true" but it does not have any effect.I want the html tags get rendered and have effect on the text.May i know wat to do for that to be executed and which version fully supports to html tags.plz help me from this probmlem. Thanksshyam:( Link to comment Share on other sites More sharing options...
HJK Posted February 21, 2007 Share Posted February 21, 2007 I have the same problem here.In my database there are (simple) html-fields which begins with: <html><head><body><b>bladibla</b> etc..etc.. That text is given into the DB in another seperate Java-app that uses the SUN HTML-AREA. I'm getting an error that <html> is not a valid tag or something. If I mannualy adjust the field to only <b>bladibla</b> it works. I'm I overlooking something, is this on the whislist? Link to comment Share on other sites More sharing options...
teodord Posted February 25, 2008 Share Posted February 25, 2008 Hi, A new text element attribute called "markup" was added to support embedding text snippets that contain style information in RTF of HTML format. The former isStyledText boolean attribute was deprecated and is now equivalent to markup="styled". All the modification are committed to SVN and will be part of the next release. A new sample /demo/samples/markup was added to show this new feature. Thank you,Teodor Link to comment Share on other sites More sharing options...
fother Posted March 5, 2008 Share Posted March 5, 2008 hello when will be the next release?where i can do the download the project that it was in svn?Post edited by: fother, at: 2008/03/04 18:44 Link to comment Share on other sites More sharing options...
teodord Posted March 7, 2008 Share Posted March 7, 2008 Hi, JR 2.0.5 release is imminent. Matter of days.You can get the source code from this SVN URL:http://scm.jasperforge.org/svn/repos/jasperreports provided that you create an account on the developer forge. Thank you,Teodor 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