Jump to content

draw a table in jasperreports's xml templete?


Recommended Posts

By: hitdemo - hitdemo

draw a table in jasperreports's xml templete?

2003-06-19 23:01

now ,i only use lines to simulate a table in xml .

can a table add to jasperreport ,and i can draw a

table in xml templete with ireport??

 

 

 

 

By: Giulio Toffoli - gt78

RE: draw a table in jasperreports's xml templete?

2003-06-20 02:15

This is a table example maded using iReport:

 

 

table.xml

 

 

<?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="untitled_report_1"

columnCount="1"

printOrder="Vertical"

orientation="Portrait"

pageWidth="595"

pageHeight="842"

columnWidth="535"

columnSpacing="0"

leftMargin="30"

rightMargin="30"

topMargin="20"

bottomMargin="20"

whenNoDataType="NoPages"

isTitleNewPage="false"

isSummaryNewPage="false">

<background>

<band height="0">

</band>

</background>

<title>

<band height="73">

</band>

</title>

<pageHeader>

<band height="0">

</band>

</pageHeader>

<columnHeader>

<band height="24">

<rectangle radius="0" >

<reportElement

mode="Opaque"

x="0"

y="0"

width="535"

height="23"

forecolor="#000000"

backcolor="#CCCCCC"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

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

</rectangle>

<line direction="TopDown">

<reportElement

mode="Opaque"

x="135"

y="0"

width="0"

height="23"

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="340"

y="0"

width="0"

height="23"

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="1"

y="0"

width="133"

height="22"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<textElement textAlignment="Center" verticalAlignment="Middle" lineSpacing="Single">

<font fontName="SansSerif" pdfFontName="Helvetica" size="12" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="CP1252" isStrikeThrough="false" />

</textElement>

<text><![CDATA[Column header 1]]></text>

</staticText>

</band>

</columnHeader>

<detail>

<band height="24">

<line direction="TopDown">

<reportElement

mode="Opaque"

x="0"

y="23"

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>

<line direction="TopDown">

<reportElement

mode="Opaque"

x="0"

y="0"

width="0"

height="23"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

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

</line>

<line direction="TopDown">

<reportElement

mode="Opaque"

x="135"

y="0"

width="0"

height="23"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

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

</line>

<line direction="TopDown">

<reportElement

mode="Opaque"

x="340"

y="0"

width="0"

height="23"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

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

</line>

<line direction="TopDown">

<reportElement

mode="Opaque"

x="534"

y="0"

width="0"

height="23"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

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

</line>

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

mode="Opaque"

x="1"

y="0"

width="133"

height="22"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

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

<font fontName="SansSerif" pdfFontName="Helvetica" size="12" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="CP1252" isStrikeThrough="false" />

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA[$F{Field}]]></textFieldExpression>

</textField>

</band>

</detail>

<columnFooter>

<band height="30">

</band>

</columnFooter>

<pageFooter>

<band height="0">

</band>

</pageFooter>

<summary>

<band height="0">

</band>

</summary>

</jasperReport>

 

 

 

 

 

 

 

By: acajax - liufenghuixue

RE: draw a table in jasperreports's xml templete?

2003-06-21 02:42

It's easy to draw a table whose rows is certain.

If the rows is uncertain,how can you do?

 

 

 

 

By: Giulio Toffoli - gt78

RE: draw a table in jasperreports's xml templete?

2003-06-21 03:36

 

How you can see, the header row is in the header band (that is repeated every time is required) and the second row (with the blank background) is repeated for each record.

 

The final result is a report with a number of rows = number of records.

 

Note that, respect the use of rectangles, this solution is better because the vertical lines stretch it with the grow of the detail. In this way you can have different row heights dependant from the data displayed and without define elements groups (that are not supported by iReport).

 

Giulio

 

 

 

 

By: acajax - liufenghuixue

RE: draw a table in jasperreports's xml templete?

2003-06-22 03:12

to gt78:

Are you ignore the problem:

The detail has another elements:such as statictext,fields,lines,etc.?On this sistution, what can we do?

 

 

 

 

By: Giulio Toffoli - gt78

RE: draw a table in jasperreports's xml templete?

2003-06-22 05:01

Sorry, but I continue to ignore the problem.

 

Can you post me a jpg with an example of what you want obtain?

 

gt (at) businesslogic.it

 

Giulio

Link to comment
Share on other sites

  • 7 months later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

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