chayan
-
Posts
2 -
Joined
-
Last visited
Content Type
Profiles
Forum
Events
Featured Visualizations
Knowledge Base
Documentation (PDF Downloads)
Blog
Documentation (Test Area)
Documentation
Dr. Jaspersoft Webinar Series
Downloads
Posts posted by chayan
-
-
i am creating a Balance sheet Report. where i want the assets and liablities must be display side by side i done that. but unfortunately an unwanted box around these two subreport appears. i will be very thank full if any one solve this problem.my reports code are below..
ParentReports (Container)
<?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="BalanceSheet1"
columnCount="1"
printOrder="Vertical"
orientation="Landscape"
pageWidth="842"
pageHeight="595"
columnWidth="782"
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="dataSource_assets" isForPrompting="false" class="net.sf.jasperreports.engine.JRDataSource"/>
<parameter name="dataSource_liablities" isForPrompting="false" class="net.sf.jasperreports.engine.JRDataSource"/>
<parameter name="liablitiesTotalStr" isForPrompting="false" class="java.lang.String"/>
<parameter name="assetTotalStr" isForPrompting="false" class="java.lang.String"/>
<background>
<band height="0" isSplitAllowed="true" >
</band>
</background>
<title>
<band height="50" isSplitAllowed="true" >
<staticText>
<reportElement
x="0"
y="0"
width="782"
height="50"
key="staticText-6"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="18" isUnderline="true"/>
</textElement>
<text><![CDATA[bALANCE SHEET]]></text>
</staticText>
</band>
</title>
<pageHeader>
<band height="100" isSplitAllowed="true" >
</band>
</pageHeader>
<columnHeader>
<band height="30" isSplitAllowed="true" >
<staticText>
<reportElement
x="0"
y="0"
width="207"
height="30"
key="staticText-2"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement verticalAlignment="Middle">
<font pdfFontName="Helvetica-Bold" size="18" isBold="true"/>
</textElement>
<text><![CDATA[Liablities]]></text>
</staticText>
<staticText>
<reportElement
x="400"
y="0"
width="207"
height="30"
key="staticText-3"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement>
<font pdfFontName="Helvetica-Bold" size="18" isBold="true"/>
</textElement>
<text><![CDATA[Assets]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="100" isSplitAllowed="true" >
<subreport isUsingCache="true">
<reportElement
x="0"
y="0"
width="391"
height="100"
forecolor="#FFFFFF"
backcolor="#FFFFFF"
key="subreport-1"
positionType="Float"/>
<dataSourceExpression><![CDATA[$P{dataSource_liablities}]]></dataSourceExpression>
<subreportExpression class="java.lang.String"><![CDATA["/root/Desktop/Report/liablities.jasper"]]></subreportExpression>
</subreport>
<subreport isUsingCache="true">
<reportElement
x="391"
y="0"
width="391"
height="100"
key="subreport-2"
positionType="Float"/>
<dataSourceExpression><![CDATA[$P{dataSource_assets}]]></dataSourceExpression>
<subreportExpression class="java.lang.String"><![CDATA["/root/Desktop/Report/assets.jasper"]]></subreportExpression>
</subreport>
</band>
</detail>
<columnFooter>
<band height="0" isSplitAllowed="true" >
</band>
</columnFooter>
<pageFooter>
<band height="0" isSplitAllowed="true" >
</band>
</pageFooter>
<lastPageFooter>
<band height="50" isSplitAllowed="true" >
<line direction="TopDown">
<reportElement
x="82"
y="19"
width="70"
height="0"
key="line-1"/>
<graphicElement stretchType="NoStretch"/>
</line>
</band>
</lastPageFooter>
<summary>
<band height="29" isSplitAllowed="true" >
<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="220"
y="0"
width="163"
height="29"
key="textField-1"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement textAlignment="Right">
<font/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$P{liablitiesTotalStr}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="619"
y="0"
width="163"
height="29"
key="textField-2"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement textAlignment="Right">
<font/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$P{assetTotalStr}]]></textFieldExpression>
</textField>
<staticText>
<reportElement
x="57"
y="0"
width="163"
height="29"
key="staticText-4"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement textAlignment="Right">
<font pdfFontName="Helvetica-BoldOblique" size="12" isBold="true" isItalic="true"/>
</textElement>
<text><![CDATA[Total]]></text>
</staticText>
<staticText>
<reportElement
x="456"
y="0"
width="163"
height="29"
key="staticText-5"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement textAlignment="Right">
<font pdfFontName="Helvetica-BoldOblique" size="12" isBold="true" isItalic="true"/>
</textElement>
<text><![CDATA[Total]]></text>
</staticText>
</band>
</summary>
</jasperReport>
Subreport 1(Liablities)
<?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="liablities"
columnCount="1"
printOrder="Vertical"
orientation="Landscape"
pageWidth="842"
pageHeight="595"
columnWidth="375"
columnSpacing="0"
leftMargin="28"
rightMargin="439"
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.*" />
<field name="grup_code" class="java.lang.Integer"/>
<field name="accm_group_name" class="java.lang.String"/>
<field name="total_Value" class="java.lang.String"/>
<background>
<band height="0" isSplitAllowed="true" >
</band>
</background>
<title>
<band height="0" isSplitAllowed="true" >
</band>
</title>
<pageHeader>
<band height="0" isSplitAllowed="true" >
</band>
</pageHeader>
<columnHeader>
<band height="0" isSplitAllowed="true" >
</band>
</columnHeader>
<detail>
<band height="18" isSplitAllowed="true" >
<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="0"
y="0"
width="60"
height="18"
key="textField-1"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement textAlignment="Left">
<font/>
</textElement>
<textFieldExpression class="java.lang.Integer"><![CDATA[$F{grup_code}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="60"
y="0"
width="181"
height="18"
key="textField-2"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement>
<font/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{accm_group_name}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="241"
y="0"
width="116"
height="18"
key="textField-3"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement textAlignment="Right">
<font/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{total_Value}]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="0" isSplitAllowed="true" >
</band>
</columnFooter>
<pageFooter>
<band height="0" isSplitAllowed="true" >
</band>
</pageFooter>
<summary>
<band height="0" isSplitAllowed="true" >
</band>
</summary>
</jasperReport>
Subreport 2 (Assets)
<?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="assets"
columnCount="1"
printOrder="Vertical"
orientation="Landscape"
pageWidth="842"
pageHeight="595"
columnWidth="375"
columnSpacing="0"
leftMargin="28"
rightMargin="439"
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.*" />
<field name="grup_code" class="java.lang.Integer"/>
<field name="accm_group_name" class="java.lang.String"/>
<field name="total_Value" class="java.lang.String"/>
<background>
<band height="0" isSplitAllowed="true" >
</band>
</background>
<title>
<band height="0" isSplitAllowed="true" >
</band>
</title>
<pageHeader>
<band height="0" isSplitAllowed="true" >
</band>
</pageHeader>
<columnHeader>
<band height="0" isSplitAllowed="true" >
</band>
</columnHeader>
<detail>
<band height="18" isSplitAllowed="true" >
<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="0"
y="0"
width="60"
height="18"
key="textField-1"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement textAlignment="Left">
<font/>
</textElement>
<textFieldExpression class="java.lang.Integer"><![CDATA[$F{grup_code}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="60"
y="0"
width="181"
height="18"
key="textField-2"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement>
<font/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{accm_group_name}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="241"
y="0"
width="116"
height="18"
key="textField-3"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement textAlignment="Right" verticalAlignment="Top">
<font/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{total_Value}]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="0" isSplitAllowed="true" >
</band>
</columnFooter>
<pageFooter>
<band height="0" isSplitAllowed="true" >
</band>
</pageFooter>
<summary>
<band height="0" isSplitAllowed="true" >
</band>
</summary>
</jasperReport>
i use following java code to feed the data....
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package test;
import agc.fa.logs.LogConfig;
import fa.report.model.bo.intrf.IntrfReport;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.sf.jasperreports.engine.JRDataSource;
import net.sf.jasperreports.engine.JREmptyDataSource;
import net.sf.jasperreports.engine.JasperRunManager;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* This class is used for testing perpose.
* @author chayan
*/
public class Test extends LogConfig {
public Test() {
super("test.Test");
}
public static void main(String str[]) {
//Test ob=new Test();
try {
ApplicationContext appCtx = new ClassPathXmlApplicationContext("fa/report/context/applicationContext.xml");
ApplicationContext lb = new ClassPathXmlApplicationContext("fa/report/context/contextLiablities.xml");
ApplicationContext ass = new ClassPathXmlApplicationContext("fa/report/context/contextAssets.xml");
ApplicationContext util = new ClassPathXmlApplicationContext("fa/report/context/utility.xml");
IntrfReport lb1 = (IntrfReport) lb.getBean("TranImplLiablities");
IntrfReport ass1 = (IntrfReport) ass.getBean("TranImplAsset");
//IntrfReport tb1=(IntrfReport) tbCtx1.getBean("TranImplLiabilitiesBalanceSheet");
/*List ls = tb.prepareReport("01-04-2008", "31-03-2009");
Iterator it = ((List) ls.get(2)).iterator();
while (it.hasNext()) {
GroupDAO ob = (GroupDAO) it.next();
System.err.println(ob.getAccm_group_name());
System.err.println(ob.getTotal_Value());
}
System.err.println((Map) ls.get(0) + "<--------------------------------" +
"----------->" + (JRDataSource) ls.get(1));*/
List tb_lb=lb1.prepareReport("01-04-2008", "31-03-2009");
List tb_ass=ass1.prepareReport("01-04-2008", "31-03-2009");
Map lb_map=(Map)tb_lb.get(0);
JRDataSource lb_dataSource=(JRDataSource)tb_lb.get(1);
Map ass_map=(Map)tb_ass.get(0);
JRDataSource ass_dataSource=(JRDataSource)tb_ass.get(1);
Map param=new HashMap();
param.put("dataSource_assets", ass_dataSource);
param.put("dataSource_liablities", lb_dataSource);
param.put("liablitiesTotalStr",(String)lb_map.get("liablitiesTotalStr") );
param.put("assetTotalStr", (String)ass_map.get("assetTotalStr"));
JasperRunManager.runReportToPdfFile("/root/Desktop/Report/BalanceSheet1.jasper", "/root/Desktop/BalanceSheet1.pdf",
param, new JREmptyDataSource());
System.err.println("HELOOOOOOOOOOOOOOOOOO");
} catch (Exception ex) {
System.err.println("The Error are " + ex);
}
}
}
how to remove default mergines in Subreport
in Products
Posted
Thanx fro reply me..
i am sending the PDF report as attachment..