Berrada Posted January 10, 2008 Share Posted January 10, 2008 Hallo, the feature of preserving the entire text even when it doesn't fit the element area is finally released. JasperReports 2.0.3 release notessupport for keeping the entire original text for text elements that do not stretch; the full text is used in data-oriented exporters such as XLS and CSV; I've changed the jar file into jasperreports-2.0.3.jar and started the export, the text is even truncated. which property do I have to set if I want to preserve the entire text? Thanks in advance Link to comment Share on other sites More sharing options...
lucianc Posted January 10, 2008 Share Posted January 10, 2008 You need to set net.sf.jasperreports.print.keep.full.text to true in one of the following places:Globally in jasperreports.propertiesAt report level:Code:<jasperReport ...> <property name="net.sf.jasperreports.print.keep.full.text" value="true"/> ...At text element level:Code:[code]<textField> <reportElement ..> <property name="net.sf.jasperreports.print.keep.full.text" value="true"/> ...[/ul] Also see [url=http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/JRTextElement.html#PROPERTY_PRINT_KEEP_FULL_TEXT]this Javadoc description. Regards,LucianPost edited by: lucianc, at: 2008/01/10 15:39 Link to comment Share on other sites More sharing options...
harivenkat Posted February 21, 2008 Share Posted February 21, 2008 Hello Lucian, I am using 2.0.3 and I still see the data gettingtruncated inspite of adding <property name="net.sf.jasperreports.print.keep.full.text" value="true"/> at jasperreport level. Please, find the jrxml. Here, the commentDisplay field is truncated. Just to let you know the isStretchWithOverflow is set to "false". If I set this to true I do see the datanot truncated. But, I want to data to be not truncated withisStretchWithOverFlow set to true. Please, advice if I am missing anything. [file name=celltruncate.txt size=7158]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/celltruncate.txt[/file] Link to comment Share on other sites More sharing options...
lucianc Posted February 21, 2008 Share Posted February 21, 2008 Could you post the XLS output as well? Regards,Lucian Link to comment Share on other sites More sharing options...
harivenkat Posted February 23, 2008 Share Posted February 23, 2008 Lucian, I am guessing what could the problem might havebeen. An older 2.0.2 version was lurking in a differentwar on the jboss application server I was deploying... which is strange. I replaced the jasper jar in this war with newer version and I am able to see it work.I might be dumb.. :) as I am procrastinating to confirm this hypothesis of mine. Any ways here is the xls. I appreciate your help Best Regards,Venkat Link to comment Share on other sites More sharing options...
harivenkat Posted February 23, 2008 Share Posted February 23, 2008 Here is the xls. [file name=generatedrep.xls size=13824]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/generatedrep.xls[/file] Link to comment Share on other sites More sharing options...
lucianc Posted February 25, 2008 Share Posted February 25, 2008 harivenkat wrote:I am guessing what could the problem might havebeen. An older 2.0.2 version was lurking in a differentwar on the jboss application server I was deploying... which is strange. I replaced the jasper jar in this war with newer version and I am able to see it work.I might be dumb.. :) as I am procrastinating to confirm this hypothesis of mine. Any ways here is the xls. I'm confused. Do you still have a problem? Regards,Lucian Link to comment Share on other sites More sharing options...
harivenkat Posted February 25, 2008 Share Posted February 25, 2008 sorry, i was trying to explain what the problem mighthave been. This issue has been resolved now. Rgds,Venkat Link to comment Share on other sites More sharing options...
mackensen Posted February 26, 2008 Share Posted February 26, 2008 Va salut, As vrea sa intreb, ce pot sa fac ca sa vad textul intreg (in textbox, in pdf) extras din database ? In sensul ca uneori se vede tot, alteori nu (lipsesc cateva cuvinte sau chiar o linie intreaga). Am incercat cu "property name="net.sf.jasperreports.print.keep.full.text" value="true", m-am uitat si in "Samples" si am citit si FAQ-urile.Trimit si fisierul jrxml. Multumesc,Mackensen Hello, I would like to ask, what can I do in order to see the whole text (in the textbox, pdf) from the database ? I mean, sometimes it's displayed ok but sometimes not (a few words missing or even 1 line). I tried with "property name="net.sf.jasperreports.print.keep.full.text" value="true", I also looked in "Samples" and I read the FAQ.Here is the jrxml. Thanx, Mackensen [file name=req_off-94669bb7e3b91b00ae72cbf6616f3442.jrxml size=21040]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/req_off-94669bb7e3b91b00ae72cbf6616f3442.jrxml[/file] Link to comment Share on other sites More sharing options...
lucianc Posted February 26, 2008 Share Posted February 26, 2008 mackensen wrote:I would like to ask, what can I do in order to see the whole text (in the textbox, pdf) from the database ? I mean, sometimes it's displayed ok but sometimes not (a few words missing or even 1 line). I tried with "property name="net.sf.jasperreports.print.keep.full.text" value="true", I also looked in "Samples" and I read the FAQ. net.sf.jasperreports.print.keep.full.text only applies to data-oriented exporters such as XLS or CSV. The layout-oriented exporters (such as PDF) will only show the part of the text that's been determined to fit the text element area at fill time. If you don't see the entire text for a text field when exporting to PDF, make sure thatThe text field element has isStretchWithOverflow="true" if the text could exceed the amount of text that would fit in the element areas.The AWT and PDF fonts match. See this FAQ for more details. This might be the culprit in your case, since I see the following thing in your JRXML:Code:<font fontName="Times New Roman" pdfFontName="Helvetica-Bold" ...[/ol] Regards,Lucian Link to comment Share on other sites More sharing options...
mackensen Posted February 26, 2008 Share Posted February 26, 2008 thanx, The jrxml I sent you it was just a test...I tried with many fonts...So, the problem is that the fonts don't match. How can I see what fonts has the JVM ? Or, better, is there a way to set the font dynamically on every JVM the program runs ? Thanx again,MackensenPost edited by: mackensen, at: 2008/02/26 12:26 Link to comment Share on other sites More sharing options...
lucianc Posted February 28, 2008 Share Posted February 28, 2008 mackensen wrote:How can I see what fonts has the JVM ? You can write a Java application that does java.awt.GraphicsEnvironment.getAllFonts() or getAvailableFontFamilyNames(), or use a 3rd party Java font browser tool. Or, better, is there a way to set the font dynamically on every JVM the program runs ? Not exactly sure what you mean by setting the font dynamically, but that's probably not supported. Style information in report templates is not exactly dynamic. Regards,Lucian Link to comment Share on other sites More sharing options...
mackensen Posted February 28, 2008 Share Posted February 28, 2008 Sorry, I didn't study very much. I already found something to see the JVM fonts. But I still don't understand. I'm in a web application and I use just jsp, beans and servlet. So, I created the jrxml file and set the fonts with iReport and then the pdf is created with Jasperreport from a servlet. You say the problem is there when I set the fonts in iReport ? (in the Properties window, where there are 2 dropdown menus: "Font name" and "Pdf font name") ?These fonts should match ? If yes, how can I set the fonts dynamically, I mean if the application runs on another jvm ? Thanx again,MackensenPost edited by: mackensen, at: 2008/02/28 11:05 Link to comment Share on other sites More sharing options...
lucianc Posted February 29, 2008 Share Posted February 29, 2008 mackensen wrote:You say the problem is there when I set the fonts in iReport ? (in the Properties window, where there are 2 dropdown menus: "Font name" and "Pdf font name") ?These fonts should match ? Yes. If yes, how can I set the fonts dynamically, I mean if the application runs on another jvm ? Report styles are static, so you only have limited options here:Dynamic AWT fonts (i.e. "Font name") can only be achieved by using Java logical fonts (such as Serif, SansSerif, etc) that could map to different physical fonts on different JVMs.Dynamic PDF fonts can be achieved by using the JRExporterParameter.FONT_MAP export parameter when exporting to PDF.[/ul] Regards,Lucian Link to comment Share on other sites More sharing options...
mackensen Posted March 5, 2008 Share Posted March 5, 2008 It still didn't work. I have a small servlet with this code: int i=0; Font[] fontlist=java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts(); Font unfont=null; for (i=0;i<fontlist.length;i++) { unfont=fontlist; out.println("Name:"+unfont.getName()+"---Family: "+unfont.getFamily()+"---FontName:"+unfont.getFontName()+"<br>"); } It displays a list of fonts like this: Name:39251---Family: 39251---FontName:39251Name:Agency FB---Family: Agency FB---FontName:Agency FBName:Agency FB Bold---Family: Agency FB---FontName:Agency FB GrassettoName:Allegro BT---Family: Allegro BT---FontName:Allegro BTName:Andale Mono---Family: Andale Mono---FontName:Andale MonoName:Arial---Family: Arial---FontName:ArialName:Arial Black---Family: Arial Black---FontName:Arial BlackName:Arial Black Italic---Family: Arial Black---FontName:Arial Black CorsivoName:Arial Bold---Family: Arial---FontName:Arial Grassetto I simply took some fonts from here (the "Family" item) and put in the jrxml so the "Font name" and "pdfFontName" have the same name. It's right ? Thanx,Mackensen Link to comment Share on other sites More sharing options...
dbhardwaj04 Posted January 30, 2009 Share Posted January 30, 2009 Dear lucianc,I am facing a similar problem with jasper reports. When I print a report in PDF, MS-WORD or Rich Text format and if the text in a particular field is large then the text get truncated at the end of the line. Please see attached file testdoc.doc. Same problem happens in all the format types (pdf, richtext format). I am attaching teh jrml as well and we are using jasper report version 2.0.4.From the above discussion, I guess this problem is coming because of fonts. I would highly appriciate if you could please help me resolving this problem.I have gone through this whole thread and tried the other options for setting<property name="net.sf.jasperreports.print.keep.full.text" value="true"/> <property name="net.sf.jasperreports.export.pdf.force.linebreak.policy" value="true"/>but none of them work.Please helpThanks and Regards,Deepak Link to comment Share on other sites More sharing options...
lucianc Posted January 31, 2009 Share Posted January 31, 2009 Have you set isStretchWithOverflow="true" for the text fields that get truncated?Regards,Lucian 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