Jump to content
We've recently updated our Privacy Statement, available here ×

Ivan.Hibbert

Members
  • Posts

    4
  • Joined

  • Last visited

Ivan.Hibbert's Achievements

Newbie

Newbie (1/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. Left aligned text in compiled sub-report using JasperStudio 6.2.2 - June, 2016 I have been searching the forums for months to try to find an answer to my Font Alignment issue. After twice THINKING I had solved it, I was mistaken yet again when I re-compiled my WORKING sub-reports with the newer version of JasperStudio. Most of the forums date this issue back many years... so if there is a fix out there, I'm somehow missing it. When I compile a sub-report with JasperStudio 6.0.3, and embed the .jasper into a report, my grails application renders it correctly in both HTML and exporting to PDF. However, when I re-compile the same sub-report with the later JasperStudio 6.2.2, all report elements' texts are LEFT ALIGNED. Everytihng I've read thus far, suggests that you can't use older versions of the jasperreports-x.x.x.jar than that used to compile the sub-report. We are using JasperStudio 6.2.2 and have imported all of the jasperreports-6.2.2.jar and associated jar files from the 6.2.2 project. I am baffled by this behaviour as there is nothing mismatched. If I re-compile any sub-report with the earlier version of JasperStudio 6.0.3, the reports render as desired (centred text etc...). The forums suggest that there was a change to the way JasperStudio handled alignment of text as of around JasperStudio 6.0.x - so the question now remains: HOW do you use the later JasperStudio and its associated jars to render a compiled subreport with correct font alignment? We have a grails application and are using the following libraries: jasperreports-6.2.2.jar jasperreports-fonts-6.2.2.jar jasperreports-javaflow-6.2.2.jar Any pointers, suggestions or helps would be greatly appreciated! Files and Technical: A new subreport was created fresh from JasperStudio 6.2.2 Designer view of Sub report using JasperStudio 6.2.2 Subreport .jrxml file as shown in JasperStudio 6.2.2: <?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.2.2.final using JasperReports Library version 6.2.2 --><!-- 2016-06-17T09:22:10 --><jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Blank_A4" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="1f0618b7-fa1a-4078-9afd-01e7d0f28e6c"> <style name="Heading 1" forecolor="#3B6E8F" fontName="Arial" fontSize="18" isBold="true"/> <queryString> <![CDATA[]]> </queryString> <title> <band height="40" splitType="Stretch"> <property name="com.jaspersoft.studio.unit.height" value="pixel"/> <textField> <reportElement style="Heading 1" x="0" y="0" width="550" height="30" uuid="bb52ca96-cc87-4788-aa1d-bab658ef3868"/> <box> <topPen lineWidth="1.0"/> <leftPen lineWidth="1.0"/> <bottomPen lineWidth="1.0"/> <rightPen lineWidth="1.0"/> </box> <textElement textAlignment="Center" verticalAlignment="Middle"> <font fontName="Times New Roman" size="20" isBold="true" isItalic="true"/> </textElement> <textFieldExpression><![CDATA["JasperStudio 6.2.2 Test"]]></textFieldExpression> </textField> </band> </title> <detail> <band height="40" splitType="Stretch"> <property name="com.jaspersoft.studio.unit.height" value="pixel"/> <textField> <reportElement x="0" y="10" width="550" height="30" uuid="1317fb6d-e4cd-44d4-8333-4bdf6ec27a25"/> <box> <topPen lineWidth="1.0" lineColor="#999999"/> <leftPen lineWidth="1.0" lineColor="#999999"/> <bottomPen lineWidth="1.0" lineColor="#999999"/> <rightPen lineWidth="1.0" lineColor="#999999"/> </box> <textElement textAlignment="Center" verticalAlignment="Middle"> <font fontName="Arial" size="14" isItalic="true"/> </textElement> <textFieldExpression><![CDATA["Text Field"]]></textFieldExpression> </textField> </band> </detail></jasperReport>[/code] Report Output when compiled with JasperStudio 6.2.2: Same subreport .jrxml file as shown in JasperStudio 6.0.3: <?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version last--><jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Blank_A4" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="1f0618b7-fa1a-4078-9afd-01e7d0f28e6c"> <style name="Heading 1" forecolor="#3B6E8F" fontName="Arial" fontSize="18" isBold="true"/> <queryString> <![CDATA[]]> </queryString> <title> <band height="40" splitType="Stretch"> <property name="com.jaspersoft.studio.unit.height" value="pixel"/> <textField> <reportElement style="Heading 1" x="0" y="0" width="550" height="30" uuid="bb52ca96-cc87-4788-aa1d-bab658ef3868"/> <box> <topPen lineWidth="1.0"/> <leftPen lineWidth="1.0"/> <bottomPen lineWidth="1.0"/> <rightPen lineWidth="1.0"/> </box> <textElement textAlignment="Center" verticalAlignment="Middle"> <font fontName="Times New Roman" size="20" isBold="true" isItalic="true"/> </textElement> <textFieldExpression><![CDATA["JasperStudio 6.2.2 Test"]]></textFieldExpression> </textField> </band> </title> <detail> <band height="40" splitType="Stretch"> <property name="com.jaspersoft.studio.unit.height" value="pixel"/> <textField> <reportElement x="0" y="10" width="550" height="30" uuid="1317fb6d-e4cd-44d4-8333-4bdf6ec27a25"/> <box> <topPen lineWidth="1.0" lineColor="#999999"/> <leftPen lineWidth="1.0" lineColor="#999999"/> <bottomPen lineWidth="1.0" lineColor="#999999"/> <rightPen lineWidth="1.0" lineColor="#999999"/> </box> <textElement textAlignment="Center" verticalAlignment="Middle"> <font fontName="Arial" size="14" isItalic="true"/> </textElement> <textFieldExpression><![CDATA["Text Field"]]></textFieldExpression> </textField> </band> </detail></jasperReport>[/code] Report Output when compiled with JasperStudio 6.0.3: As you can see, the text aligns as per the Design only when compiled with the EARLIER JasperStudio version 6.0.3. So, what have I missed? What do I need to use the Latest versions and keep the sub-report text alignment as per the design? Thank you for your help -- ANYONE???? Icy
  2. Hi Hozawa, I am trying to post a new question regarding mis-aligned fonts in compiled sub-reports when compiling with JasperStudio 6.2.0, but I cannot seem to post any new questions. Can you please allow me to post a new question so I can expalin my issue. Thanks Icy
  3. EDIT to above post: It seems as though my efforts (from the post above) were only a partial fix for the whole font issue. It turns out that the true fix was to take the latest version of jasperreports-fonts-6.2.2.jar and unpack it (can be done by changing the .jar to .zip). Once unpacked, I could edit the jasperreports_extension.properties to include new fontfaces I planned to add, following THIS example. I also had to copy in the new font files and update the fonts.xml to include the new fonts and reference them, but that was a simple copy and paste of a previous fontFamily and edit the fields. Once saved, I could re-package the jar file with my own name (I used the java jar command jar -cfM myFonts.jar .) With my new myFonts.jar in my grails lib directory, all fonts behaved as planned, including italic, bold and bold-italic. Any fonts I reference in my jrxml which were not present, defaulted to a plain Helvetica. Below is the resluting files. jasperreports_extension.properties: net.sf.jasperreports.extension.registry.factory.simple.font.families=net.sf.jasperreports.engine.fonts.SimpleFontExtensionsRegistryFactory net.sf.jasperreports.extension.simple.font.families.dejavu=net/sf/jasperreports/fonts/fonts.xml net.sf.jasperreports.extension.simple.font.families.arial=net/sf/jasperreports/fonts/fonts.xml net.sf.jasperreports.extension.simple.font.families.timesnewroman=net/sf/jasperreports/fonts/fonts.xml fonts.xml: <?xml version="1.0" encoding="UTF-8"?> <fontFamilies> <fontFamily name="Times New Roman"> <normal>net/sf/jasperreports/fonts/timesnewroman/times.ttf</normal> <bold>net/sf/jasperreports/fonts/timesnewroman/timesbd.ttf</bold> <italic>net/sf/jasperreports/fonts/timesnewroman/timesi.ttf</italic> <boldItalic>net/sf/jasperreports/fonts/timesnewroman/timesbi.ttf</boldItalic> <pdfEncoding>Identity-H</pdfEncoding> <pdfEmbedded>true</pdfEmbedded> <exportFonts> <export key="net.sf.jasperreports.html">'Times New Roman', Arial, Helvetica, sans-serif</export> <export key="net.sf.jasperreports.xhtml">'Times New Roman', Arial, Helvetica, sans-serif</export> </exportFonts> <!-- <locales> <locale>en_US</locale> <locale>de_DE</locale> </locales> --> </fontFamily> <fontFamily name="Arial"> <normal>net/sf/jasperreports/fonts/arial/arial.ttf</normal> <bold>net/sf/jasperreports/fonts/arial/arialbd.ttf</bold> <italic>net/sf/jasperreports/fonts/arial/ariali.ttf</italic> <boldItalic>net/sf/jasperreports/fonts/arial/arialbi.ttf</boldItalic> <pdfEncoding>Identity-H</pdfEncoding> <pdfEmbedded>true</pdfEmbedded> <exportFonts> <export key="net.sf.jasperreports.html">'Arial', Arial, Helvetica, sans-serif</export> <export key="net.sf.jasperreports.xhtml">'Arial', Arial, Helvetica, sans-serif</export> </exportFonts> <!-- <locales> <locale>en_US</locale> <locale>de_DE</locale> </locales> --> </fontFamily> <fontFamily name="DejaVu Sans"> <normal>net/sf/jasperreports/fonts/dejavu/DejaVuSans.ttf</normal> <bold>net/sf/jasperreports/fonts/dejavu/DejaVuSans-Bold.ttf</bold> <italic>net/sf/jasperreports/fonts/dejavu/DejaVuSans-Oblique.ttf</italic> <boldItalic>net/sf/jasperreports/fonts/dejavu/DejaVuSans-BoldOblique.ttf</boldItalic> <pdfEncoding>Identity-H</pdfEncoding> <pdfEmbedded>true</pdfEmbedded> <exportFonts> <export key="net.sf.jasperreports.html">'DejaVu Sans', Arial, Helvetica, sans-serif</export> <export key="net.sf.jasperreports.xhtml">'DejaVu Sans', Arial, Helvetica, sans-serif</export> </exportFonts> <!-- <locales> <locale>en_US</locale> <locale>de_DE</locale> </locales> --> </fontFamily> <fontFamily name="DejaVu Serif"> <normal>net/sf/jasperreports/fonts/dejavu/DejaVuSerif.ttf</normal> <bold>net/sf/jasperreports/fonts/dejavu/DejaVuSerif-Bold.ttf</bold> <italic>net/sf/jasperreports/fonts/dejavu/DejaVuSerif-Italic.ttf</italic> <boldItalic>net/sf/jasperreports/fonts/dejavu/DejaVuSerif-BoldItalic.ttf</boldItalic> <pdfEncoding>Identity-H</pdfEncoding> <pdfEmbedded>true</pdfEmbedded> <exportFonts> <export key="net.sf.jasperreports.html">'DejaVu Serif', 'Times New Roman', Times, serif</export> <export key="net.sf.jasperreports.xhtml">'DejaVu Serif', 'Times New Roman', Times, serif</export> </exportFonts> </fontFamily> <fontFamily name="DejaVu Sans Mono"> <normal>net/sf/jasperreports/fonts/dejavu/DejaVuSansMono.ttf</normal> <bold>net/sf/jasperreports/fonts/dejavu/DejaVuSansMono-Bold.ttf</bold> <italic>net/sf/jasperreports/fonts/dejavu/DejaVuSansMono-Oblique.ttf</italic> <boldItalic>net/sf/jasperreports/fonts/dejavu/DejaVuSansMono-BoldOblique.ttf</boldItalic> <pdfEncoding>Identity-H</pdfEncoding> <pdfEmbedded>true</pdfEmbedded> <exportFonts> <export key="net.sf.jasperreports.html">'DejaVu Sans Mono', 'Courier New', Courier, monospace</export> <export key="net.sf.jasperreports.xhtml">'DejaVu Sans Mono', 'Courier New', Courier, monospace</export> </exportFonts> </fontFamily> <!-- Mapping Java logical fonts, for the sake of HTML export only. --> <fontFamily name="SansSerif"> <exportFonts> <export key="net.sf.jasperreports.html">'DejaVu Sans', Arial, Helvetica, sans-serif</export> <export key="net.sf.jasperreports.xhtml">'DejaVu Sans', Arial, Helvetica, sans-serif</export> </exportFonts> </fontFamily> <fontFamily name="Serif"> <exportFonts> <export key="net.sf.jasperreports.html">'DejaVu Serif', 'Times New Roman', Times, serif</export> <export key="net.sf.jasperreports.xhtml">'DejaVu Serif', 'Times New Roman', Times, serif</export> </exportFonts> </fontFamily> <fontFamily name="Monospaced"> <exportFonts> <export key="net.sf.jasperreports.html">'DejaVu Sans Mono', 'Courier New', Courier, monospace</export> <export key="net.sf.jasperreports.xhtml">'DejaVu Sans Mono', 'Courier New', Courier, monospace</export> </exportFonts> </fontFamily> </fontFamilies> Maybe THIS post will save someone a heap of trouble. Kind reagards, Icy
  4. Sub-Report fonts not working - FIXED I have a groovy/grails application from which I call my .jrxml files to render jasper reports. Thse do not need to be compiled, but any reports having a sub-report MUST have the sub-report component compiled to a .jasper which is referenced from my applicatoin and called at runtime. The font related issue I have been experiencing is that wherever I have called a pre-compiled sub-report, the fonts I use do not appear in either the right fontface, size or bold/italic - I simply lose control over the font altogether. This has been with only the sub-report component of the whole report, the main report produces exactly as expected. After searching the web, and the Japser comminity for 18 months, and trying the font import /export to .jar and import into my grails app, nothing worked. I tried all of the suggested methods of adding each font as a .jar file, butn nothing seemed to work for me. Finally, I upgraded the version of the jasper plugin I was using in my grails app, and instantly, the font issues vanished and the whole report was finally being rendered correctly, pre-compiled sub-reports and all! The whole thing was finally playing ball. That's after 18 months. This fixed it! Previosuly I had the following line in my BuildConfig.groovy file compile ":jasper:1.8.0" but when I changed it to the most recent version and re-compiled my project, all of the font face/size issues simply dissappeared. Here's my plugin line now. compile "org.grails.plugins:jasper:1.11.0" I sure hope this saves someone else from having to serach the web for 18 months. Regards, Icy
×
×
  • Create New...