Ajenjo Posted April 22, 2008 Share Posted April 22, 2008 Hi. I have to show a number right aligned. But it not do it, it appears in the left. The code: Code:(...) <textField isStretchWithOverflow="true" pattern="#,##0.00" hyperlinkType="None"> <reportElement stretchType="RelativeToBandHeight" x="450" y="0" width="82" height="15" backcolor="#CCCCCC"/> <textElement textAlignment="Right" verticalAlignment="Bottom"> <font isStrikeThrough="false"/> </textElement> <textFieldExpression class="java.lang.Float"><![CDATA[$F{importe}]]></textFieldExpression> </textField>(...) I write it as a String but have the same result. Any idea? Thanks Link to comment Share on other sites More sharing options...
Ajenjo Posted April 24, 2008 Author Share Posted April 24, 2008 I tried to put a style element ( <style name="estilo" hAlign="Right"/> ) Code:<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD JasperReport//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd"><jasperReport name="albaran" pageWidth="595" pageHeight="842" columnWidth="535" leftMargin="30" rightMargin="30" topMargin="20" bottomMargin="20"> <style name="estilo" hAlign="Right"/> <property name="ireport.scriptlethandling" value="2"/>(...) to use it in reportElement Code:[code](...)<reportElement stretchType="RelativeToBandHeight" style="estilo" x="450" y="0" width="82" height="15" backcolor="#CCCCCC"/>(...) but show me the error : net.sf.jasperreports.engine.JRException: org.xml.sax.SAXParseException: The content of element type "jasperReport" must match "(property*,import*,template*,reportFont*,style*,subDataset*,parameter*,queryString?,field*,sortField*,variable*,filterExpression?,group*,background?,title?,pageHeader?,columnHeader?,detail?,columnFooter?,pageFooter?,lastPageFooter?,summary?,noData?)". at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:243) at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:226) at com.jaspersoft.ireport.designer.compiler.IReportCompiler.loadJasperDesign(IReportCompiler.java:1775) at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:503) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:561) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:986) Caused by: org.xml.sax.SAXParseException: The content of element type "jasperReport" must match "(property*,import*,template*,reportFont*,style*,subDataset*,parameter*,queryString?,field*,sortField*,variable*,filterExpression?,group*,background?,title?,pageHeader?,columnHeader?,detail?,columnFooter?,pageFooter?,lastPageFooter?,summary?,noData?)". at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236) Any help? Post edited by: Ajenjo, at: 2008/04/24 09:51 Post edited by: Ajenjo, at: 2008/04/24 09:57Post edited by: Ajenjo, at: 2008/04/24 09:59 Link to comment Share on other sites More sharing options...
marin Posted September 23, 2008 Share Posted September 23, 2008 I have the same problem! :-(. But I have it managing the version 3.0 of iReport: http://jasperforge.org/plugins/espforum/view.php?group_id=83&forumid=101&topicid=45947 I give you a bit of the code with the text box that contains the align text. The tags are from iReport 2.0.5 and the .jasper works in 2.0.5 and 3.0. If I compile the report in iReport 3.0, then the problem appears. Pay attemption to the this tag: </font>.I don't know why was this generate without tag <font> previously. Could anyone help us?Code:<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" > <reportElement style="cabecera" x="0" y="0" width="180" height="33" key="textField-1"/> <box> </box> <textElement textAlignment="Right"> <font/> </textElement> <textFieldExpression class="java.lang.String"> <![CDATA[(...)]]> </textFieldExpression></textField> Link to comment Share on other sites More sharing options...
lucianc Posted September 24, 2008 Share Posted September 24, 2008 I've tested the text element that you posted and it worked fine for me.Could you post a full self-contained sample to reproduce this? Also include the report output (PDF or HTML or other format in which you see the text not being aligned properly).Regards,Lucian Link to comment Share on other sites More sharing options...
szaharia Posted September 24, 2008 Share Posted September 24, 2008 AjenjoWrote: I tried to put a style element ( <style name="estilo" hAlign="Right"/> ) Code: to use it in reportElement Code: but show me the error : net.sf.jasperreports.engine.JRException: org.xml.sax.SAXParseException: The content of element type "jasperReport" must match "(property*,import*,template*,reportFont*,style*,subDataset*,parameter*,queryString?,field*,sortField*,variable*,filterExpression?,group*,background?,title?,pageHeader?,columnHeader?,detail?,columnFooter?,pageFooter?,lastPageFooter?,summary?,noData?)". at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:243) at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:226) at com.jaspersoft.ireport.designer.compiler.IReportCompiler.loadJasperDesign(IReportCompiler.java:1775) at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:503) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:561) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:986) Caused by: org.xml.sax.SAXParseException: The content of element type "jasperReport" must match "(property*,import*,template*,reportFont*,style*,subDataset*,parameter*,queryString?,field*,sortField*,variable*,filterExpression?,group*,background?,title?,pageHeader?,columnHeader?,detail?,columnFooter?,pageFooter?,lastPageFooter?,summary?,noData?)". at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236) Any help? Post edited by: Ajenjo, at: 2008/04/24 09:51 Post edited by: Ajenjo, at: 2008/04/24 09:57 Post edited by: Ajenjo, at: 2008/04/24 09:59 Hi Ajenjo, The SAXParseException you got above means that in your jrxml the <style name="estilo" hAlign="Right"/> element should be posted after the <property name="ireport.scriptlethandling" value="2"/> element, and not before it. Hope this helps,sandaPost Edited by sanda zaharia at 09/24/08 13:06Post Edited by sanda zaharia at 09/24/08 13:07 Link to comment Share on other sites More sharing options...
nehaagrawal30 Posted October 10, 2008 Share Posted October 10, 2008 Even I have faced this problem.I solved it by following this approach.There is a sequence for tags in JRXMl file.Like first <property> , <import> , <reportFont>... etc.If you change this sequence , you may get this error.I hope it may help someone. 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