Jump to content
Changes to the Jaspersoft community edition download ×

Problems due to font in HTML,PDF,EXCEL


Recommended Posts

By: jayalakshmi - jayashaki

Problems due to font in HTML,PDF,EXCEL

2004-01-03 01:28

Hello all,

The reports are generating fine in PDF,HTML,EXCEL formats, but the font size in HTML is very small when compared with PDF,EXCEL.I cannot do modifications in XML as b'cos it will refelct in all the three. So, i have written a function using the class JRDesignReportFont, but the problem is I want some text to be bold and some to be in normal. The Bold is not working, so i started to use the normal font with isBold="true", but as i change the size in java file it affects only to the textFieldExpressions i.e. $F not for static text,the size is changed only to the datas from the database and for the static text, it remains the same. Kindly help me.

XML file:

<?xml version="1.0"?>

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

<jasperReport

name="UserBasedReport"

columnCount="1"

printOrder="Vertical"

pageWidth="595"

pageHeight="842"

columnWidth="270"

columnSpacing="15"

leftMargin="20"

rightMargin="20"

topMargin="30"

bottomMargin="30"

isTitleNewPage="true"

isSummaryNewPage="false"

whenNoDataType="AllSectionsNoDetail">

 

<!--<reportFont name="Times_Bold" isDefault="false" fontName="Times New Roman MS" size = "10" isBold="true" pdfFontName="Times-Bold" pdfEncoding="Cp1252" isPdfEmbedded="true"/>

<reportFont name="Times_Normal" isDefault="true" fontName="Times New Roman MS" size = "9" isBold="true" pdfFontName="Times-Bold" pdfEncoding="Cp1252" isPdfEmbedded="true"/> -->

 

<parameter name="MySQLQuery" class="java.lang.String"/>

<parameter name="SELECTION" class="java.lang.String"/>

<parameter name="date" class="java.lang.String"/>

<parameter name="FOOTER" class="java.lang.String"/>

 

 

<queryString>$P!{MySQLQuery}</queryString>

 

<field name="F410101" class="java.lang.String"/>

<field name="USER_ID" class="java.lang.String"/>

<field name="F410998" class="java.lang.String"/>

<field name="FIRST_NAME" class="java.lang.String"/>

<field name="LAST_NAME" class="java.lang.String"/>

<field name="F400102" class="java.lang.String"/>

<field name="THERAPEUTIC_NAME" class="java.lang.String"/>

<field name="THERAPEUTIC_ID" class="java.lang.Integer"/>

<field name="F330102" class="java.lang.String"/>

<field name="PRODUCT_NAME" class="java.lang.String"/>

<field name="PRODUCT_ID" class="java.lang.Integer"/>

<field name="F450104" class="java.lang.String"/>

<field name="ROLE" class="java.lang.String"/>

<field name="DURATION_FROM" class="java.util.Date"/>

<field name="DURATION_TO" class="java.util.Date"/>

<field name="F450105" class="java.lang.Integer"/>

<field name="QUERY_COUNT" class="java.lang.Integer"/>

<field name="PERSON_CODE" class="java.lang.String"/>

<field name="F410999" class="java.lang.Integer"/>

<field name="REC_ID" class="java.lang.Integer"/>

 

 

 

<group name="UserBasedGroup" isStartNewPage="false" minHeightToStartNewPage="20">

</group>

 

 

<!--TITLE SECTION -->

 

 

 

<title>

<band height="670">

 

 

<!-- DATE / TIME -->

 

 

<staticText>

<reportElement x="375" y="0" width="65" height="25" forecolor="#000000" />

<textElement textAlignment="Right">

<font isBold="true" pdfFontName="Times-Roman" />

</textElement>

<text>Date/Time:</text>

</staticText>

<textField>

<reportElement x="442" y="0" width="120" height="25" forecolor="#000000"/>

<textElement textAlignment="Center">

<font isBold="true" pdfFontName="Times-Roman" />

</textElement>

<textFieldExpression class="java.lang.String">

$P{date}

</textFieldExpression>

</textField>

 

<!-- TITLE-->

 

 

<staticText>

<reportElement x="140" y="40" width="200" height="25" forecolor="#000000"/>

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

<font isBold="true" pdfFontName="Times-Roman" />

<!--<font size="16"/> -->

</textElement>

<text>USER BASED REPORT</text>

</staticText>

 

 

 

<!-- HEADING -->

 

 

<staticText>

<reportElement x="140" y="90" width="200" height="25" forecolor="#000000"/>

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

<font isBold="true" pdfFontName="Times-Roman" />

</textElement>

<text>Selection Criteria</text>

</staticText>

<textField>

<reportElement x="200" y="145" width="400" height="250" forecolor="#000000"/>

<textElement textAlignment="Left">

<font isBold="true" pdfFontName="Times-Roman" />

</textElement>

<textFieldExpression class="java.lang.String">

$P{SELECTION}

</textFieldExpression>

</textField>

 

 

<!--FOOTER -->

 

 

<staticText>

<reportElement x="100" y="640" width="150" height="25" forecolor="#000000"/>

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

<font isBold="true" pdfFontName="Times-Roman" />

</textElement>

<text>Report generated by </text>

</staticText>

<textField>

<reportElement x="255" y="640" width="150" height="25" forecolor="#000000"/>

<textElement textAlignment="Center">

<font isBold="true" pdfFontName="Times-Roman" />

</textElement>

<textFieldExpression class="java.lang.String">

$P{FOOTER}

</textFieldExpression>

</textField>

 

 

<!-- PAGE NUMBER -->

 

 

<staticText>

<reportElement x="450" y="640" width="60" height="25" forecolor="#000000"/>

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

<font isBold="true" pdfFontName="Times-Roman" />

</textElement>

<text>Page 1 of </text>

</staticText>

 

<textField evaluationTime="Report" evaluationGroup="FirstLetterGroup">

<reportElement x="512" y="640" width="30" height="25"/>

<textElement textAlignment="Left">

<font isBold="true" pdfFontName="Times-Roman" />

</textElement>

<textFieldExpression class="java.lang.Integer">

$V{PAGE_NUMBER}

</textFieldExpression>

</textField>

 

 

</band>

 

</title>

 

 

<!-- COLUMN HEADER SECTION -->

 

 

<columnHeader>

<band height="400">

 

 

<elementGroup>

 

 

<!-- FOR HORIZONTAL LINES BELOW THE COLUMN HEADER -->

 

 

<line>

<reportElement x="1" y="30" width="88" height="0" forecolor="#000000"/>

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

</line>

<line>

<reportElement x="91" y="30" width="63" height="0" forecolor="#000000"/>

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

</line>

<line>

<reportElement x="156" y="30" width="98" height="0" forecolor="#000000"/>

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

</line>

<line>

<reportElement x="256" y="30" width="63" height="0" forecolor="#000000"/>

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

</line>

<line>

<reportElement x="321" y="30" width="118" height="0" forecolor="#000000"/>

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

</line>

<line>

<reportElement x="441" y="30" width="108" height="0" forecolor="#000000"/>

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

</line>

 

 

<!-- FOR VERTICAL LINES -->

 

 

 

<line>

<reportElement x="0" y="-9" width="0" height="375" forecolor="#000000"/>

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

</line>

 

<line>

<reportElement x="90" y="-9" width="0" height="375" forecolor="#000000"/>

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

</line>

 

<line>

<reportElement x="155" y="-9" width="0" height="375" forecolor="#000000"/>

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

</line>

 

<line>

<reportElement x="255" y="-9" width="0" height="375" forecolor="#000000"/>

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

</line>

 

<line>

<reportElement x="320" y="-9" width="0" height="375" forecolor="#000000"/>

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

</line>

 

<line>

<reportElement x="440" y="-9" width="0" height="375" forecolor="#000000"/>

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

</line>

 

<line>

<reportElement x="550" y="-9" width="0" height="375" forecolor="#000000"/>

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

</line>

 

</elementGroup>

 

 

 

<elementGroup>

 

 

<!-- TOP HORIZONTAL LINE OF THE TABLE -->

 

 

<line>

<reportElement x="0" y="-10" width="550" height="0" forecolor="#000000"/>

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

 

</line>

 

</elementGroup>

 

 

 

<!-- STATIC TEXT : USER NAME -->

 

 

<staticText>

<reportElement x="10" y="-1" width="60" height="28" mode="Opaque" isPrintWhenDetailOverflows="true" isPrintInFirstWholeBand="true"/>

<textElement textAlignment="Center">

<font isBold="true" pdfFontName="Times-Roman" />

</textElement>

<text>User Name </text>

</staticText>

 

 

<!-- STATIC TEXT : PRODUCT -->

 

 

 

<staticText>

<reportElement x="100" y="-1" width="50" height="28" mode="Opaque" isPrintWhenDetailOverflows="true" isPrintInFirstWholeBand="true"/>

<textElement textAlignment="Center">

<font isBold="true" pdfFontName="Times-Roman" />

</textElement>

<text>Product</text>

</staticText>

 

 

<!-- STATIC TEXT : THERAPEUTIC NAME -->

 

 

<staticText>

<reportElement x="160" y="-1" width="90" height="28" mode="Opaque" isPrintWhenDetailOverflows="true" isPrintInFirstWholeBand="true"/>

<textElement textAlignment="Center">

<font isBold="true" pdfFontName="Times-Roman" />

</textElement>

<text>Therapeutic Name</text>

</staticText>

 

 

<!-- STATIC TEXT : ROLE -->

 

 

<staticText>

<reportElement x="260" y="-1" width="50" height="28" mode="Opaque" isPrintWhenDetailOverflows="true" isPrintInFirstWholeBand="true"/>

<textElement textAlignment="Center">

<font isBold="true" pdfFontName="Times-Roman" />

</textElement>

<text>Role</text>

</staticText>

 

 

<!-- STATIC TEXT : NUMBER OF INQUIRIES ASSIGNED -->

 

 

<staticText>

<reportElement x="323" y="-1" width="110" height="28" mode="Opaque" isPrintWhenDetailOverflows="true" isPrintInFirstWholeBand="true"/>

<textElement textAlignment="Center">

<font isBold="true" pdfFontName="Times-Roman" />

</textElement>

<text>No.of Inquiries Assigned</text>

</staticText>

 

 

<!-- STATIC TEXT : NUMBER OF INQUIRIES -->

 

 

<staticText>

<reportElement x="455" y="-1" width="80" height="28" mode="Opaque" isPrintWhenDetailOverflows="true" isPrintInFirstWholeBand="true"/>

<textElement textAlignment="Center">

<font isBold="true" pdfFontName="Times-Roman" />

</textElement>

<text>No.of Inquiries</text>

</staticText>

</band>

</columnHeader>

 

 

<!-- DETAIL SECTION -->

 

 

<detail>

<band height="23">

 

 

<!-- TEXT FIELD : USER NAME -->

 

 

 

<textField isStretchWithOverflow="true" >

<reportElement x="2" y="-350" width="86" height="15" positionType="Float" isPrintWhenDetailOverflows="true"/>

<textElement textAlignment="Center">

<font isBold="false" pdfFontName="Times-Roman" />

</textElement>

<textFieldExpression class="java.lang.String">

$F{USER_ID}

</textFieldExpression>

</textField>

 

 

<!-- TEXT FIELD : PRODUCT -->

 

 

 

<textField isBlankWhenNull="true" isStretchWithOverflow="true" >

<reportElement x="92" y="-350" width="61" height="15" isPrintWhenDetailOverflows="true"/>

<textElement textAlignment="Center">

<font isBold="false" pdfFontName="Times-Roman" />

</textElement>

<textFieldExpression class="java.lang.String">

$F{PRODUCT_NAME}

</textFieldExpression>

</textField>

 

 

<!-- TEXT FIELD : THERAPEUTIC NAME -->

 

 

 

<textField isBlankWhenNull="true" isStretchWithOverflow="true" >

<reportElement x="157" y="-350" width="96" height="15" isPrintWhenDetailOverflows="true"/>

<textElement textAlignment="Center">

<font isBold="false" pdfFontName="Times-Roman" />

</textElement>

<textFieldExpression class="java.lang.String">

$F{THERAPEUTIC_NAME}

</textFieldExpression>

</textField>

 

 

<!-- TEXT FIELD :ROLE -->

 

 

 

 

<textField isBlankWhenNull="true" isStretchWithOverflow="true" >

<reportElement x="257" y="-350" width="61" height="15" isPrintWhenDetailOverflows="true"/>

<textElement textAlignment="Center">

<font isBold="false" pdfFontName="Times-Roman" />

</textElement>

<textFieldExpression class="java.lang.String">

$F{ROLE}

</textFieldExpression>

</textField>

 

 

<!-- TEXT FIELD : NUMBER OF QUIRIES ASSIGNED -->

 

 

 

<textField isBlankWhenNull="true" isStretchWithOverflow="true" >

<reportElement x="322" y="-350" width="116" height="15" isPrintWhenDetailOverflows="true"/>

<textElement textAlignment="Center">

<font isBold="false" pdfFontName="Times-Roman" />

</textElement>

<textFieldExpression class="java.lang.Integer">

$F{QUERY_COUNT}

</textFieldExpression>

</textField>

 

 

 

<!-- TEXT FIELD : NUMBER OF QUIRIES -->

 

 

 

<textField isBlankWhenNull="true" isStretchWithOverflow="true" >

<reportElement x="442" y="-350" width="106" height="15" isPrintWhenDetailOverflows="true"/>

<textElement textAlignment="Center">

<font isBold="false" pdfFontName="Times-Roman" />

</textElement>

<textFieldExpression class="java.lang.Integer">

$F{F410999}

</textFieldExpression>

</textField>

</band>

</detail>

 

 

<!-- COLUMN FOOTER SECTION -->

 

 

<columnFooter>

<band height="55">

<line>

<reportElement x="0" y="-331" width="550" height="0" forecolor="#000000"/>

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

 

</line>

</band>

</columnFooter>

 

 

 

<!-- PAGE FOOTER SECTION -->

 

 

<pageFooter>

<band height="30">

 

 

 

<!--FOOTER -->

 

 

 

<staticText>

<reportElement x="100" y="10" width="150" height="20" forecolor="#000000"/>

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

<font isBold="true" pdfFontName="Times-Roman" />

</textElement>

<text>Report generated by </text>

</staticText>

<textField>

<reportElement x="255" y="10" width="150" height="20" forecolor="#000000"/>

<textElement textAlignment="Center">

<font isBold="true" pdfFontName="Times-Roman" />

</textElement>

<textFieldExpression class="java.lang.String">

$P{FOOTER}

</textFieldExpression>

</textField>

 

 

 

 

<!-- FOR PAGE NUMBER -->

 

 

<staticText>

<reportElement x="440" y="10" width="40" height="20"/>

<textElement textAlignment="Left">

<font isBold="true" pdfFontName="Times-Roman" />

</textElement>

<text>Page</text>

</staticText>

 

<textField>

<reportElement x="482" y="10" width="25" height="20"/>

<textElement textAlignment="Right">

<font isBold="true" pdfFontName="Times-Roman" />

</textElement>

<textFieldExpression class="java.lang.Integer">

$V{PAGE_NUMBER}

</textFieldExpression>

</textField>

<staticText>

<reportElement x="510" y="10" width="15" height="20"/>

<textElement textAlignment="Left">

<font isBold="true" pdfFontName="Times-Roman" />

</textElement>

<text>of</text>

</staticText>

<textField evaluationTime="Report" evaluationGroup="FirstLetterGroup">

<reportElement x="526" y="10" width="25" height="20"/>

<textElement textAlignment="Left">

<font isBold="true" pdfFontName="Times-Roman" />

</textElement>

<textFieldExpression class="java.lang.Integer">

$V{PAGE_NUMBER}

</textFieldExpression>

</textField>

 

</band>

</pageFooter>

 

 

</jasperReport>

 

JAVA file:

 

package com.sysarris.medcomm.app;

 

 

import java.util.*;

import java.sql.*;

import java.io.*;

import java.net.*;

import dori.jasper.engine.JasperExportManager;

import dori.jasper.engine.xml.JRXmlLoader;

import dori.jasper.engine.design.*;

import dori.jasper.engine.util.JRQueryExecuter;

import dori.jasper.engine.*;

import dori.jasper.engine.export.*;

import dori.jasper.engine.util.*;

import dori.jasper.view.*;

import java.awt.*;

 

public class JasperRepBean{

 

public static Connection conn = null;

private String sqlQuery = null;

private String realPath = null;

private int reportFormat = 0;

private String repTemplate = null;

private int reportNo = 0;

private String repCriteria = null;

private String repUsername = null;

private String destPath = null;

 

 

public void setSqlQuery(String FileStr) {

this.sqlQuery = FileStr;

}

 

public void setRealPath(String PathStr) {

this.realPath = PathStr;

}

 

public void setReportFormat(int reportFormat) {

this.reportFormat = reportFormat;

}

 

public void setRepTemplate(String repTemplate) {

this.repTemplate = repTemplate;

}

 

public void setreportNo(int reportNo) {

this.reportNo = reportNo;

}

 

public void setrepCriteria(String repCriteria) {

this.repCriteria = repCriteria;

}

 

public void setrepUsername(String repUsername) {

this.repUsername = repUsername;

}

 

public void setdestPath(String destPath) {

this.destPath = destPath;

}

 

 

public String getSqlQuery() {

return sqlQuery;

}

 

public String getRealPath() {

return realPath;

}

 

public int getReportFormat() {

return reportFormat;

}

 

public String getRepTemplate() {

return repTemplate;

}

 

public int getreportNo() {

return reportNo;

}

 

public String getrepCriteria() {

return repCriteria;

}

public String getrepUsername() {

return repUsername;

}

 

public String getdestPath() {

return destPath;

}

 

 

//This Estabilishes the connection

public static Connection getConnection(){

try{

String url = (String)InitApplicationParams.getApplicationProperty("DB_URL");

String userName = (String)InitApplicationParams.getApplicationProperty("DB_USER");

String password = (String)InitApplicationParams.getApplicationProperty("DB_PASSWORD");

String driverName = "oracle.jdbc.driver.OracleDriver";

Class.forName("oracle.jdbc.driver.OracleDriver");

conn = DriverManager.getConnection(url, userName, password);

return conn;

}catch(Exception se){

se.printStackTrace();

return null;

}

}

 

// this method gets the sysdate from oracle database

public static String getSysdate(){

try{

 

Connection lcnSysdate=null;

Statement lstmtSysdate=null;

ResultSet lrsSysdate=null;

String repSysdate = null;

lcnSysdate = getConnection();

lstmtSysdate=lcnSysdate.createStatement();

lrsSysdate=lstmtSysdate.executeQuery("select to_char(sysdate,'DD-Mon-YYYY HH:MM:SS') from DUAL");

while(lrsSysdate.next())

{

repSysdate=lrsSysdate.getString(1);

}

return repSysdate;

}catch(Exception se){

return null;

}

}

 

private JasperDesign getJasperDesign(String sourceFileName, int repFormat) throws JRException

{

try

{

 

JasperDesign jasperDesign = JRXmlLoader.load(sourceFileName);

jasperDesign.setName(getRepTemplate());

 

System.out.println("Getting Report Template");

 

//Fonts

JRDesignReportFont normalFont = new JRDesignReportFont();

normalFont.setName("Times_Normal1");

normalFont.setDefault(true);

normalFont.setFontName("Times New Roman MS");

normalFont.setBold(true);

/* normalFont.setPdfFontName("Times-Roman");

normalFont.setPdfEncoding("Cp1252");

normalFont.setPdfEmbedded(false);*/

jasperDesign.addFont(normalFont);

 

JRDesignReportFont boldFont = new JRDesignReportFont();

boldFont.setName("Times_Bold1");

boldFont.setDefault(false);

boldFont.setFontName("Times New Roman MS");

boldFont.setBold(true);

/*boldFont.setPdfFontName("Times-Bold");

boldFont.setPdfEncoding("Cp1252");

boldFont.setPdfEmbedded(false);

jasperDesign.addFont(boldFont); */

 

 

if(repFormat == 1)

{

 

System.out.println(" Getting into - PDF");

normalFont.setSize(14);

 

boldFont.setSize(13);

 

}

else if(repFormat==2)

{

System.out.println(" Getting into - HTML");

 

normalFont.setSize(20);

boldFont.setSize(25);

 

}

 

else if(repFormat==3)

{

System.out.println(" Getting into - EXCEL");

normalFont.setSize(12);

boldFont.setSize(50);

 

}

 

System.out.println("Getting Report Font");

return jasperDesign;

 

}

catch (JRException e)

{

e.printStackTrace();

System.exit(1);

}return null;

 

 

 

}

 

public String repNameCompileReport(String sourceFileName, int repFormat) throws JRException

{

File sourceFile = new File(sourceFileName);

System.out.println("Source file");

 

//JasperDesign jasperDesign = JRXmlLoader.load(sourceFileName);

// jasperDesign.setName(getRepTemplate());

 

JasperDesign jasperDesign = getJasperDesign(sourceFileName,repFormat);

 

 

System.out.println("Getting into Dest file");

 

File destFile = new File(sourceFile.getParent(), jasperDesign.getName() + ".jasper");

String destFileName = destFile.toString();

 

System.out.println("Getting out Destination file");

System.out.println("Starts to compile");

JasperCompileManager.compileReportToFile(jasperDesign, destFileName);

System.out.println("Compilation completed");

 

return destFileName;

}

 

 

// this method converts the xml to HTML

public void convertHtml(String repTempFill){

try{

//JasperExportManager.exportReportToHtmlFile(repTempFill);

JasperExportManager.exportReportToHtmlFile(repTempFill,getdestPath());

}catch (JRException e){

e.printStackTrace();

System.exit(1);

}catch (Exception e){}

}

 

 

//this method converts the xml to Pdf

public void convertPdf(String repTempFill){

try{

 

//JasperExportManager.exportReportToPdfFile(repTempFill);

JasperExportManager.exportReportToPdfFile(repTempFill,getdestPath());

}catch (JRException e){

e.printStackTrace();

System.exit(1);

}catch (Exception e){}

}

 

//this method converts the xml to EXCEL

public void convertExcel(String repTempFill,File sourceFile){

try{

 

JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(repTempFill);

File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".xls");

JRXlsExporter exporter = new JRXlsExporter();

exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);

exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString());

exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.TRUE);

// exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE);

exporter.exportReport();

 

}catch (JRException e){

//e.printStackTrace();

//System.exit(1);

}catch (Exception e){

//e.printStackTrace();

}

}

 

 

 

//This gets the parameters and build the query

public void buildReport(){

int repNumber = 0;

int repFormat = 0;

String repTempFill = "";

String repTemplate = "";

String destfileName="";

//Specify the parameters values and bind it to the key

Map parameters =new HashMap();

Connection conObj = null;

try{

conObj = getConnection();

if(!(getReportFormat()+"").equals("") ){

repFormat = getReportFormat();

}

 

 

if(!(getreportNo()+"").equals("") ){

repNumber = getreportNo();

}

 

 

if(repNumber==1)

{

 

System.out.println("Report number one is called");

parameters.put("MySQLQuery",getSqlQuery());

parameters.put("SELECTION",getrepCriteria());

parameters.put("date",getSysdate());

parameters.put("FOOTER",getrepUsername());

String lStrQry = parameters.get("MySQLQuery").toString();

//compiles the xml file

destfileName=repNameCompileReport(getRealPath(),repFormat);

repTempFill = JasperFillManager.fillReportToFile(destfileName, parameters, conObj);

}

if(repNumber==2)

{

parameters.put("MySQLQuery",getSqlQuery());

parameters.put("SELECTION",getrepCriteria());

parameters.put("date",getSysdate());

parameters.put("FOOTER",getrepUsername());

String lStrQry = parameters.get("MySQLQuery").toString();

//compiles the xml file

destfileName=repNameCompileReport(getRealPath(),repFormat);

repTempFill = JasperFillManager.fillReportToFile(destfileName, parameters, conObj);

}

 

if(repNumber==3)

{

parameters.put("MySQLQuery",getSqlQuery());

parameters.put("SELECTION",getrepCriteria());

parameters.put("date",getSysdate());

parameters.put("FOOTER",getrepUsername());

String lStrQry = parameters.get("MySQLQuery").toString();

//compiles the xml file

destfileName=repNameCompileReport(getRealPath(),repFormat);

repTempFill = JasperFillManager.fillReportToFile(destfileName, parameters, conObj);

}

 

if(repNumber==4)

{

parameters.put("MySQLQuery",getSqlQuery());

parameters.put("SELECTION",getrepCriteria());

parameters.put("date",getSysdate());

parameters.put("FOOTER",getrepUsername());

String lStrQry = parameters.get("MySQLQuery").toString();

//compiles the xml file

destfileName=repNameCompileReport(getRealPath(),repFormat);

repTempFill = JasperFillManager.fillReportToFile(destfileName, parameters, conObj);

}

 

if(repNumber==5)

{

parameters.put("MySQLQuery",getSqlQuery());

parameters.put("SELECTION",getrepCriteria());

parameters.put("date",getSysdate());

parameters.put("FOOTER",getrepUsername());

String lStrQry = parameters.get("MySQLQuery").toString();

//compiles the xml file

destfileName=repNameCompileReport(getRealPath(),repFormat);

repTempFill = JasperFillManager.fillReportToFile(destfileName, parameters, conObj);

}

 

 

if(repFormat==1)

{

convertPdf(repTempFill);

}

 

else if(repFormat==2)

{

convertHtml(repTempFill);

}

 

else if(repFormat==3)

{

File sourceFile = new File(getdestPath());

convertExcel(repTempFill,sourceFile);

}

else

{

System.out.println("unsupported format");

}

 

 

try{

if(!conObj.isClosed()){

conObj.close();

}

}catch(Exception e){}

 

 

}catch (JRException e){

//e.printStackTrace();

try{

if(!conObj.isClosed()){

conObj.close();

}

}catch (Exception e3){}

}catch (Exception e1){

//e1.printStackTrace();

try{

if(!conObj.isClosed()){

conObj.close();

}

}catch (Exception e4){}

}

}

}

 

 

 

 

 

 

 

By: Vinod Kumar Singh - vinodsingh

RE: Problems due to font in HTML,PDF,EXCEL

2004-01-03 03:19

While I am unable to fully understand your problem but to increase the font size in HTML file, without changing the xml source try to modify the <JRHtmlExporter.java> instead of <JRDesignReportFont.java>.

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