2013-04-02 175 views
-2

這是我的模板:如何減少jasper ireport中的空白?

<?xml version="1.0" encoding="UTF-8"?> 
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="report_viwe_2" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isIgnorePagination="true" uuid="3cb87247-a775-45d7-b09b-4211897bff60"> 
    <property name="ireport.zoom" value="1.0"/> 
    <property name="ireport.x" value="0"/> 
    <property name="ireport.y" value="96"/> 
    <queryString language="SQL"> 
     <![CDATA[SELECT 
    team.`teamno` AS team_teamno, 
    team.`teamlead` AS team_teamlead, 
    team.`teammem1` AS team_teammem1, 
    team.`teammem2` AS team_teammem2 
FROM 
    `team` team]]> 
    </queryString> 
    <field name="team_teamno" class="java.lang.String"/> 
    <field name="team_teamlead" class="java.lang.String"/> 
    <field name="team_teammem1" class="java.lang.String"/> 
    <field name="team_teammem2" class="java.lang.String"/> 
    <group name="team_teamlead"> 
     <groupExpression><![CDATA[$F{team_teamlead}]]></groupExpression> 
    </group> 
    <background> 
     <band splitType="Stretch"/> 
    </background> 
    <title> 
     <band height="79" splitType="Stretch"/> 
    </title> 
    <pageHeader> 
     <band height="35" splitType="Stretch"/> 
    </pageHeader> 
    <columnHeader> 
     <band height="61" splitType="Stretch"/> 
    </columnHeader> 
    <detail> 
     <band height="125" splitType="Stretch"> 
      <textField> 
       <reportElement uuid="bff92bff-1492-496c-b0e5-5e5e38f341e5" x="24" y="33" width="100" height="20"/> 
       <textElement/> 
       <textFieldExpression><![CDATA[$F{team_teamno}]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement uuid="fa26359e-2fc7-4fdf-a972-9265832c77ac" x="162" y="33" width="100" height="20"/> 
       <textElement/> 
       <textFieldExpression><![CDATA[$F{team_teamlead}]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement uuid="c425bb55-97cb-4949-8926-3159f109aaa8" x="284" y="33" width="100" height="20"/> 
       <textElement/> 
       <textFieldExpression><![CDATA[$F{team_teammem1}]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement uuid="9dda41b1-e0f1-403d-ae59-ee7fe15889a3" x="414" y="33" width="100" height="20"/> 
       <textElement/> 
       <textFieldExpression><![CDATA[$F{team_teammem2}]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement uuid="d6efe743-2133-45da-82ba-f8eb56e82c9e" x="39" y="4" width="100" height="20"/> 
       <textElement/> 
       <textFieldExpression><![CDATA[$F{team_teamno}]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement uuid="d1b79bae-55ae-47e3-9b16-403af876b6d0" x="185" y="9" width="100" height="20"/> 
       <textElement/> 
       <textFieldExpression><![CDATA[$F{team_teamlead}]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement uuid="a653ec3b-4ce4-4871-b784-a7fa9878293a" x="297" y="4" width="100" height="20"/> 
       <textElement/> 
       <textFieldExpression><![CDATA[$F{team_teammem1}]]></textFieldExpression> 
      </textField> 
      <textField> 
       <reportElement uuid="c4bb9aa3-3dc2-4db0-a13b-31d43b1972d3" x="447" y="12" width="100" height="20"/> 
       <textElement/> 
       <textFieldExpression><![CDATA[$F{team_teammem2}]]></textFieldExpression> 
      </textField> 
     </band> 
    </detail> 
    <columnFooter> 
     <band height="45" splitType="Stretch"/> 
    </columnFooter> 
    <pageFooter> 
     <band height="54" splitType="Stretch"/> 
    </pageFooter> 
    <summary> 
     <band height="42" splitType="Stretch"/> 
    </summary> 
</jasperReport> 

PHP代碼:

<?php 

//Import the PhpJasperLibrary 
include_once('PhpJasperLibrary/tcpdf/tcpdf.php'); 
include_once("PhpJasperLibrary/PHPJasperXML.inc.php"); 


//database connection details 

$server="localhost"; 
$db="facility"; 
$user="root"; 
$pass="infinit"; 
$version="0.8b"; 
$pgport=5432; 
$pchartfolder="./class/pchart2"; 


//display errors should be off in the php.ini file 
ini_set('display_errors', 0); 

//setting the path to the created jrxml file 
$xml = simplexml_load_file("report_viwe_2.jrxml"); 

$PHPJasperXML = new PHPJasperXML(); 
//$PHPJasperXML->debugsql=true; 
//$PHPJasperXML->arrayParameter=array("parameter1"=>1); 
$PHPJasperXML->xml_dismantle($xml); 

$PHPJasperXML->transferDBtoArray($server,$user,$pass,$db); 
$PHPJasperXML->outpage("I"); //page output method I:standard output D:Download file 


?> 

我只是試圖打印使用PHP網頁上的碧玉報告。

問題是在網頁上打印時,第一頁將是空白,在下一頁它將顯示數據。我正在減少樂隊的高度。但還有一個額外的頁面出現..任何人都可以解決這個問題..

+0

那麼你是如何使用PHP打印它?我假設你有一些PHP代碼來這樣做。它在哪裏? –

+0

@Mark Ba​​ker:感謝回覆這篇文章,我發佈了我的PHP代碼..! – kalpana

回答

1

擺脫你的空樂隊。您有title,pageHeadercolumnHeader已宣佈高度但尚未使用的波段。這些樂隊將出現在您的細節樂隊之前。完全刪除它們或者至少將它們的高度設置爲零。

您還有background,columnFooter,pageFootersummary頻段爲空且可以刪除。

+0

謝謝GenericJon .. !!它的工作...... !!! – kalpana