Jump to content

Export Problem


totalylouco

Recommended Posts

I have a Servlet that is exporting a report to PDF, HTML and XLS, my problem is that when I export to PDF Eerithing in the report is export, When I export to HTML or XLS some data is omited... I get The same thing when using Ireport 1.3.1

 

How can I format the report to prevent this????

 

Thanks

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hi,

 

Could you be more specific? What kind of data were omitted? Could you send us your report sample?

Until then, I would only suggest you to use the JExcelApiExporter when exporting to XLS (instead of JRXlsExporter).

Also, you have to configure properly your HTML exporter (see the demo/samples/webapp in the JR distribution).

 

HTH,

sanda

Link to comment
Share on other sites

First of all, thanks for the reply so soon

Here is the code for my report

Code:

<?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="Contributos"
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">
<property name="ireport.scriptlethandling" value="0" />
<property name="ireport.encoding" value="UTF-8" />
<import value="java.util.*" />
<import value="net.sf.jasperreports.engine.*" />
<import value="net.sf.jasperreports.engine.data.*" />

<parameter name="evento_id" isForPrompting="true" class="java.lang.String"/>
<queryString><![CDATA[select username, t_contributo_titulo, t_contributo_texto, t_contributo_data_introducao,
t_contributo_validado_5_div, t_contributo_validado_sub_cema, t_topico_nome,
t_evento_nome, fk_contributo_id_topico
from contributos,evento,topicos, contact_
where contributos.fk_contributo_id_topico = topicos.pk_t_topico_id and
topicos.fk_topico_id_evento = evento.pk_t_evento_id and
contact_.contactid = contributos.userid and
evento.pk_t_evento_id = $P{evento_id}

order by t_topico_nome]]></queryString>

<field name="username" class="java.lang.String"/>
<field name="t_contributo_titulo" class="java.lang.String"/>
<field name="t_contributo_texto" class="java.lang.String"/>
<field name="t_contributo_data_introducao" class="java.sql.Date"/>
<field name="t_contributo_validado_5_div" class="java.lang.Boolean"/>
<field name="t_contributo_validado_sub_cema" class="java.lang.Boolean"/>
<field name="t_topico_nome" class="java.lang.String"/>
<field name="t_evento_nome" class="java.lang.String"/>
<field name="fk_contributo_id_topico" class="java.lang.String"/>


<group name="fk_contributo_id_topico" >
<groupExpression><![CDATA[$F{fk_contributo_id_topico}]]></groupExpression>
<groupHeader>
<band height="25" isSplitAllowed="true" >
<rectangle>
<reportElement
mode="Opaque"
x="0"
y="0"
width="535"
height="25"
forecolor="#8080FF"
backcolor="#000000"
key="rectangle"/>
<graphicElement stretchType="NoStretch" pen="None"/>
</rectangle>
<staticText>
<reportElement
x="3"
y="2"
width="96"
height="23"
forecolor="#FFFFFF"
backcolor="#FFFFFF"
key="staticText"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement>
<font size="16"/>
</textElement>
<text><![CDATA[topicO]]></text>
</staticText>
<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="102"
y="2"
width="424"
height="23"
forecolor="#FFFFFF"
backcolor="#FFFFFF"
key="textField"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement>
<font size="18"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{t_topico_nome}]]></textFieldExpression>
</textField>
</band>
</groupHeader>
<groupFooter>
<band height="2" isSplitAllowed="true" >
</band>
</groupFooter>
</group>
<background>
<band height="0" isSplitAllowed="true" >
</band>
</background>
<title>
<band height="50" isSplitAllowed="true" >
<line direction="TopDown">
<reportElement
x="0"
y="48"
width="534"
height="0"
key="line"/>
<graphicElement stretchType="NoStretch"/>
</line>
<line direction="TopDown">
<reportElement
x="0"
y="3"
width="534"
height="0"
key="line"/>
<graphicElement stretchType="NoStretch"/>
</line>
<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="94"
y="5"
width="326"
height="38"
key="textField"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement textAlignment="Center">
<font size="24"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{t_evento_nome}]]></textFieldExpression>
</textField>
</band>
</title>
<pageHeader>
<band height="10" isSplitAllowed="true" >
<line direction="BottomUp">
<reportElement
x="0"
y="9"
width="535"
height="0"
key="line"/>
<graphicElement stretchType="NoStretch"/>
</line>
</band>
</pageHeader>
<columnHeader>
<band height="0" isSplitAllowed="true" >
</band>
</columnHeader>
<detail>
<band height="148" isSplitAllowed="true" >
<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="177"
y="4"
width="348"
height="16"
forecolor="#000000"
backcolor="#FFFFFF"
key="textField"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement textAlignment="Left">
<font size="12"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{username}]]></textFieldExpression>
</textField>
<staticText>
<reportElement
x="0"
y="4"
width="146"
height="17"
forecolor="#000000"
backcolor="#FFFFFF"
key="staticText"
positionType="Float"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement>
<font size="12"/>
</textElement>
<text><![CDATA[user id]]></text>
</staticText>
<textField isStretchWithOverflow="false" pattern="dd/MM/yyyy" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="177"
y="67"
width="348"
height="16"
forecolor="#000000"
backcolor="#FFFFFF"
key="textField"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement textAlignment="Left">
<font size="12"/>
</textElement>
<textFieldExpression class="java.util.Date"><![CDATA[$F{t_contributo_data_introducao}]]></textFieldExpression>
</textField>
<staticText>
<reportElement
x="0"
y="67"
width="146"
height="17"
forecolor="#000000"
backcolor="#FFFFFF"
key="staticText"
positionType="Float"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement>
<font size="12"/>
</textElement>
<text><![CDATA[contributo data introducao]]></text>
</staticText>
<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="177"
y="46"
width="348"
height="16"
forecolor="#000000"
backcolor="#FFFFFF"
key="textField"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement textAlignment="Left">
<font size="12"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{t_contributo_texto}]]></textFieldExpression>
</textField>
<staticText>
<reportElement
x="0"
y="46"
width="146"
height="17"
forecolor="#000000"
backcolor="#FFFFFF"
key="staticText"
positionType="Float"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement>
<font size="12"/>
</textElement>
<text><![CDATA[contributo texto]]></text>
</staticText>
<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="177"
y="88"
width="348"
height="16"
forecolor="#000000"
backcolor="#FFFFFF"
key="textField"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement textAlignment="Left">
<font size="12"/>
</textElement>
<textFieldExpression class="java.lang.Boolean"><![CDATA[$F{t_contributo_validado_5_div}]]></textFieldExpression>
</textField>
<staticText>
<reportElement
x="1"
y="88"
width="146"
height="17"
forecolor="#000000"
backcolor="#FFFFFF"
key="staticText"
positionType="Float"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement>
<font size="12"/>
</textElement>
<text><![CDATA[contributo validado 5 div]]></text>
</staticText>
<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="177"
y="111"
width="348"
height="16"
forecolor="#000000"
backcolor="#FFFFFF"
key="textField"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement textAlignment="Left">
<font size="12"/>
</textElement>
<textFieldExpression class="java.lang.Boolean"><![CDATA[$F{t_contributo_validado_sub_cema}]]></textFieldExpression>
</textField>
<staticText>
<reportElement
x="1"
y="111"
width="146"
height="17"
forecolor="#000000"
backcolor="#FFFFFF"
key="staticText"
positionType="Float"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement>
<font size="12"/>
</textElement>
<text><![CDATA[contributo validado sub_cema]]></text>
</staticText>
<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="177"
y="25"
width="348"
height="16"
forecolor="#000000"
backcolor="#FFFFFF"
key="textField"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement textAlignment="Left">
<font size="12"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{t_contributo_titulo}]]></textFieldExpression>
</textField>
<staticText>
<reportElement
x="0"
y="25"
width="146"
height="17"
forecolor="#000000"
backcolor="#FFFFFF"
key="staticText"
positionType="Float"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement>
<font size="12"/>
</textElement>
<text><![CDATA[contributo titulo]]></text>
</staticText>
<line direction="TopDown">
<reportElement
x="3"
y="138"
width="531"
height="0"
key="line-1"/>
<graphicElement stretchType="NoStretch"/>
</line>
</band>
</detail>
<columnFooter>
<band height="0" isSplitAllowed="true" >
</band>
</columnFooter>
<pageFooter>
<band height="27" isSplitAllowed="true" >
<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="325"
y="4"
width="170"
height="19"
forecolor="#000000"
backcolor="#FFFFFF"
key="textField"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement textAlignment="Right">
<font size="10"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA["Page " + $V{PAGE_NUMBER} + " of "]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Report" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="499"
y="4"
width="36"
height="19"
forecolor="#000000"
backcolor="#FFFFFF"
key="textField"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement>
<font size="10"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA["" + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<line direction="TopDown">
<reportElement
x="0"
y="3"
width="535"
height="0"
key="line"/>
<graphicElement stretchType="NoStretch"/>
</line>
<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="1"
y="6"
width="209"
height="19"
forecolor="#000000"
backcolor="#FFFFFF"
key="textField"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement>
<font size="10"/>
</textElement>
<textFieldExpression class="java.util.Date"><![CDATA[new Date()]]></textFieldExpression>
</textField>
</band>
</pageFooter>
<summary>
<band height="0" isSplitAllowed="true" >
</band>
</summary>
</jasperReport>

 

The things that desapear are the things inside FK_contributo_id_topico_header group

Post edited by: totalylouco, at: 2007/03/13 14:17

Link to comment
Share on other sites

I ran the sample with an empty database and saw that the "TOPICO" row seems not to be displayed in html and xls.

If this is the only problem, I could say that's because of overlapping elements (the <rectangle/> element and the <staticText/> in your <group/> definition). In fact, the "TOPIC" text does appear, but its forecolor is WHITE (#FFFFFF), and the html exporter does not consider the other element (the <rectangle/>) which has the black background (see here some more detailed info).

To avoid such situations, your static text should have its own properties well defined. You could define a style in your report, with all properties you want to be applied to your text (backcolor, forecolor, etc), and set this style to the incriminated <reportElement/>.

 

Please let me know if the problem persists,

sanda

Link to comment
Share on other sites

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