Jump to content
Changes to the Jaspersoft community edition download ×

kosalendra.singh1

Members
  • 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

Everything posted by kosalendra.singh1

  1. I have a subreport embedded in the first page of the jasper. I have to change the sql query for the subreport but when I do that no subreport data is printed. I am passing a parameter from the main report to the subreport, Also invoice_date is matched from two table like this inv_sumary_invoice_date = TO_DATE ($P{INVOICE_DATE}, 'DD-MM-YYYY') --[inv_sumary_invoice_date (DATE)] invoice_date = $P{INVOICE_DATE} -- [invoice_date (VARCHAR2)] NOTE: When I replace the new query with the old one, data is available again I can not share the code
  2. No matter how many times I change or by how much I change the font size, it always stays the same in the generated pdf. Due to this most of data in static fields is getting truncated. All the text on the pdf has the same font size. Any sugestions on how to change the font size. I'm using the following code to generate pdfs. package rponte.report;import java.io.FileNotFoundException;import java.io.FileOutputStream;import java.sql.Connection;import java.sql.SQLException;import java.util.HashMap;import java.util.Map;import net.sf.jasperreports.engine.JRException;import net.sf.jasperreports.engine.JRExporter;import net.sf.jasperreports.engine.JRExporterParameter;import net.sf.jasperreports.engine.JasperCompileManager;import net.sf.jasperreports.engine.JasperFillManager;import net.sf.jasperreports.engine.JasperPrint;import net.sf.jasperreports.engine.export.JRPdfExporter;import rponte.report.ConnectionFactory;public class ReportGenerator { public static void main(String[] args) { Connection connection = null; try { String reportName = "myreport"; Map<String, String> parameters = new HashMap<String, String>(); parameters.put("ACCOUNT_NO","x"); parameters.put("INVOICE_DATE","z"); parameters.put("SEGMENT_ID","y"); parameters.put("SUBREPORT_DIR","./"); //step1 load the driver class Class.forName("oracle.jdbc.driver.OracleDriver"); //step2 create the connection object connection=DriverManager.getConnection( "jdbc:oracle:thin:@localhost:me","system","oracle"); // compiles jrxml JasperCompileManager.compileReportToFile("Corporate.jrxml"); // fills compiled report with parameters and a connection JasperPrint print = JasperFillManager.fillReport("Corporate.jasper", parameters, connection); // exports report to pdf JRExporter exporter = new JRPdfExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, print); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, new FileOutputStream(reportName + ".pdf")); // your output goes here exporter.exportReport(); } catch (Exception e) { throw new RuntimeException("It's not possible to generate the pdf report.", e); } finally { // it's your responsibility to close the connection, don't forget it! if (connection != null) { try { connection.close(); } catch (Exception e) {} } } } }[/code]
×
×
  • Create New...