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

Align text no work correctly


Ajenjo

Recommended Posts

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

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

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:57

Post edited by: Ajenjo, at: 2008/04/24 09:59

Link to comment
Share on other sites

  • 4 months later...

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

Ajenjo
Wrote:

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,

sanda



Post Edited by sanda zaharia at 09/24/08 13:06



Post Edited by sanda zaharia at 09/24/08 13:07
Link to comment
Share on other sites

  • 3 weeks later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...