Jump to content
JasperReports Library 7.0 is now available ×

Data from mysql not display correctly?


Recommended Posts

By: hitdemo - hitdemo

Data from mysql not display correctly?

2003-05-21 00:15

-------------------

<?xml version="1.0" encoding="UTF-8" ?>

<!-- Created with iReport - A designer for JasperReports -->

<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

<jasperReport

name="mydoc2"

columnCount="1"

printOrder="Vertical"

orientation="Portrait"

pageWidth="595"

pageHeight="842"

columnWidth="535"

columnSpacing="56"

leftMargin="30"

rightMargin="30"

topMargin="20"

bottomMargin="19"

whenNoDataType="NoPages"

isTitleNewPage="false"

isSummaryNewPage="false">

<reportFont name="SimSun" isDefault="true" fontName="SimSun" size="10" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="false"/>

<queryString><![CDATA[select * from student order by Id]]></queryString>

<field name="Id" class="java.lang.Integer">

<fieldDescription>id</fieldDescription>

</field>

<field name="Name" class="java.lang.String">

<fieldDescription>Name</fieldDescription>

</field>

<variable name="test" class="java.lang.Integer" resetType="Page" calculation="Sum">

<variableExpression>$F{Id}</variableExpression> <initialValueExpression><![CDATA[new Integer(0)]]></initialValueExpression> </variable>

<background>

<band height="50">

</band>

</background>

<title>

<band height="50">

<line direction="TopDown">

<reportElement

mode="Opaque"

x="0"

y="48"

width="534"

height="0"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<graphicElement stretchType="NoStretch" pen="2Point" fill="Solid" />

</line>

<line direction="TopDown">

<reportElement

mode="Opaque"

x="0"

y="3"

width="534"

height="0"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<graphicElement stretchType="NoStretch" pen="2Point" fill="Solid" />

</line>

<staticText>

<reportElement

mode="Transparent"

x="180"

y="9"

width="234"

height="31"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single">

<font reportFont="SimSun"/>

</textElement>

<text>学生纪录</text>

</staticText>

</band>

</title>

<pageHeader>

<band height="55">

<image scaleImage="RetainShape" vAlign="Top" hAlign="Left" isUsingCache="false" evaluationTime="Now" hyperlinkType="None"> <reportElement

mode="Opaque"

x="253"

y="7"

width="34"

height="35"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<graphicElement stretchType="NoStretch" pen="None" fill="Solid" />

<imageExpression class="java.lang.String"><![CDATA["G:\JBuilder8\thirdparty\jakarta-tomcat-4.1.24\webapps\jpreportdemo\images\dukesign.jpg"]]></imageExpression> </image>

</band>

</pageHeader>

<columnHeader>

<band height="55">

<line direction="BottomUp">

<reportElement

mode="Opaque"

x="0"

y="55"

width="535"

height="0"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<graphicElement stretchType="NoStretch" pen="Thin" fill="Solid" />

</line>

<staticText>

<reportElement

mode="Transparent"

x="154"

y="14"

width="52"

height="15"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single">

<font reportFont="SimSun"/>

</textElement>

<text>Id</text>

</staticText>

<staticText>

<reportElement

mode="Transparent"

x="318"

y="12"

width="54"

height="15"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single">

<font reportFont="SimSun"/>

</textElement>

<text>Name</text>

</staticText>

<line direction="TopDown">

<reportElement

mode="Opaque"

x="256"

y="1"

width="0"

height="100"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<graphicElement stretchType="NoStretch" pen="Thin" fill="Solid" />

</line>

</band>

</columnHeader>

<detail>

<band height="46">

<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement

mode="Transparent"

x="102"

y="10"

width="94"

height="15"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single">

<font reportFont="SimSun"/>

</textElement>

<textFieldExpression class="java.lang.Integer">$F{Id}</textFieldExpression>

</textField>

<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement

mode="Transparent"

x="315"

y="10"

width="90"

height="15"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single">

<font reportFont="SimSun"/>

</textElement>

<textFieldExpression class="java.lang.String">$F{Name}</textFieldExpression>

</textField>

<line direction="TopDown">

<reportElement

mode="Opaque"

x="58"

y="33"

width="404"

height="0"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<graphicElement stretchType="NoStretch" pen="Thin" fill="Solid" />

</line>

</band>

</detail>

<columnFooter>

<band height="55">

<staticText>

<reportElement

mode="Transparent"

x="235"

y="15"

width="60"

height="15"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single">

<font reportFont="SimSun"/>

</textElement>

<text>page footer</text>

</staticText>

</band>

</columnFooter>

<pageFooter>

<band height="27">

<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement

mode="Transparent"

x="308"

y="5"

width="174"

height="19"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<textElement textAlignment="Right" verticalAlignment="Top" lineSpacing="Single">

<font reportFont="SimSun"/>

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA["Page " + $V{PAGE_NUMBER} + " of "]]></textFieldExpression>

</textField>

<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Report" hyperlinkType="None" > <reportElement

mode="Transparent"

x="488"

y="5"

width="42"

height="19"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single">

<font reportFont="SimSun"/>

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA["" + $V{PAGE_NUMBER}]]></textFieldExpression>

</textField>

<line direction="TopDown">

<reportElement

mode="Opaque"

x="1"

y="3"

width="535"

height="0"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<graphicElement stretchType="NoStretch" pen="2Point" fill="Solid" />

</line>

<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement

mode="Transparent"

x="1"

y="6"

width="209"

height="19"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single">

<font reportFont="SimSun"/>

</textElement>

<textFieldExpression class="java.util.Date"><![CDATA[new Date()]]></textFieldExpression>

</textField>

<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Page" hyperlinkType="None" > <reportElement

mode="Transparent"

x="221"

y="9"

width="80"

height="11"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single">

<font reportFont="SimSun"/>

</textElement>

<textFieldExpression class="java.lang.Integer">$V{test}</textFieldExpression>

</textField>

</band>

</pageFooter>

<summary>

<band height="55">

</band>

</summary>

</jasperReport>

---------------------

with this i can display chinese in html and pdf,but it is only limited to static text,

when i retrieve data from mysql'testdb and display Name field's record (contain chinese) on $F{Name} ,it is display incorrectly?

Does static text be not differ from $F{......}?

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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...