Jump to content
We've recently updated our Privacy Statement, available here ×

bcaramu

Members
  • Posts

    5
  • Joined

  • Last visited

bcaramu's Achievements

Rookie

Rookie (2/14)

  • First Post Rare
  • Conversation Starter Rare
  • Week One Done
  • One Month Later
  • One Year In

Recent Badges

0

Reputation

  1. Hi Friends, I am using Jasper 3.1.2 version with Hibernate 3.2.6 ga, JDK 6.0. Here I am facing one problem with below: I Have a master report which contained a sub report in <columnFooter> tag . In master & sub reports I have hql See attachments Here master report generating correctly but subreport data is not displying in report java code: InputStream stream = new ClassPathResource("WebActivityMain.jrxml").getInputStream(); InputStream subReportHourlyStream = new ClassPathResource("WebActivityHourlyReport.jrxml").getInputStream(); HashMap<String, Object> parameters = new HashMap<String, Object>(); JasperDesign subReportHourlyDesign = JRXmlLoader.load(subReportHourlyStream); JasperReport subReportHourlyReport = JasperCompileManager.compileReport(subReportHourlyDesign); JasperDesign design = JRXmlLoader.load(stream); JasperReport report = JasperCompileManager.compileReport(design); List<WebActivityHourlyResults> subReportHourlyData = dao.getWebActivityHourlyReport(portfolioIds); parameters.put("HourlySubreport", subReportHourlyReport); parameters.put("subData", subReportHourlyData); parameters.put(JRHibernateQueryExecuterFactory.PARAMETER_HIBERNATE_SESSION, dao.getHibSession()); JasperPrint print = JasperFillManager.fillReport(report,parameters); JExcelApiExporter exporter = new JExcelApiExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT,print); exporter.setParameter(JRXlsExporterParameter.CHARACTER_ENCODING, "UTF-8"); File destFile = new File(exportLocation, reportName + "."+ exportType); exporter.setParameter(JRExporterParameter.OUTPUT_FILE,destFile); exporter.setParameter(JRXlsExporterParameter.IS_IGNORE_CELL_BORDER,Boolean.TRUE); exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,Boolean.TRUE); exporter.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND,Boolean.FALSE); exporter.setParameter(JRXlsExporterParameter.IGNORE_PAGE_MARGINS,Boolean.TRUE); exporter.exportReport(); Please help me in this code Post Edited by Rama Krishna at 01/20/09 04:16
  2. Hi, I written below code create excel file. the excel file was created successfully in both environments like windows & Linux. Created excel file is opening without any errors in Windows execution. But when am opening file created in LInux execution file getting error like below Microsoft Office Excel File Repair Log Errors were detected in file 'C:Documents and Settingsramakrishna.gLocal SettingsTemporary Internet FilesOLKD8CMC_CreditOne_200812302326_902.xls' The following is a list of repairs: Damage to the file was so extensive that repairs were not possible. Excel attempted to recover your formulas and values, but some data may have been lost or corrupted. Code:JRXlsExporter exporter = new JRXlsExporter();exporter.setParameter(JRExporterParameter.JASPER_PRINT, print);File destFile = new File(exportLocation, reportName + "."+ EXTENSION_XLS);exporter.setParameter(JRExporterParameter.OUTPUT_FILE,destFile);exporter.setParameter(JRXlsExporterParameter.IS_IGNORE_CELL_BORDER,Boolean.TRUE);exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,Boolean.TRUE);exporter.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND,Boolean.FALSE);exporter.setParameter(JRXlsExporterParameter.IGNORE_PAGE_MARGINS,Boolean.TRUE);exporter.exportReport();exportedFile = exportLocation + "" + reportName + "."+ EXTENSION_XLS;
  3. Hi, I written below code create excel file. the excel file was created successfully in both environments like windows & Linux. Created excel file is opening without any errors in Windows execution. But when am opening file created in LInux execution file getting error like below Microsoft Office Excel File Repair Log Errors were detected in file 'C:Documents and Settingsramakrishna.gLocal SettingsTemporary Internet FilesOLKD8CMC_CreditOne_200812302326_902.xls' The following is a list of repairs: Damage to the file was so extensive that repairs were not possible. Excel attempted to recover your formulas and values, but some data may have been lost or corrupted. Code: JRXlsExporter exporter = new JRXlsExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, print); File destFile = new File(exportLocation, reportName + "." + EXTENSION_XLS); exporter.setParameter(JRExporterParameter.OUTPUT_FILE, destFile); exporter.setParameter( JRXlsExporterParameter.IS_IGNORE_CELL_BORDER, Boolean.TRUE); exporter .setParameter( JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE); exporter.setParameter( JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE); exporter .setParameter( JRXlsExporterParameter.IGNORE_PAGE_MARGINS, Boolean.TRUE); exporter.exportReport(); exportedFile = exportLocation + "\" + reportName + "." + EXTENSION_XLS;
  4. I have 2 doubts in jasper 1) I have column “averagePlacementBalance” in DB as decimal. Some times I will get null as data for this column, at that time I need to display it as 0(zero). <textField pattern="$#,##0.00" hyperlinkType="None"> <reportElement x="354" y="0" width="111" height="15"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font fontName="Calibri" size="11"/> </textElement> <textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{averagePlacementBalance}]]></textFieldExpression> </textField> 2) When am exporting my report to CSV format then column width is too small when we compared with xls. So how can we stretch the column length to longest value of that field?
  5. Hi All Please tell me what is problem in my code I need the solution . Please in this Problem Code:Exception:Exception in thread "main" java.lang.ClassCastException: net.sf.jasperreports.engine.JasperReport cannot be cast to net.sf.jasperreports.engine.JasperPrint at net.sf.jasperreports.engine.JRAbstractExporter.setInput(JRAbstractExporter.java:640) at net.sf.jasperreports.engine.export.JRXlsAbstractExporter.exportReport(JRXlsAbstractExporter.java:179) at com.cmc.report.launch.ReportController.main(ReportController.java:108)Source: File sourceFile = (new ClassPathResource(jdbcSampleReportJasperFile)) .getFile(); System.out.println(sourceFile.canRead()); JasperReport jasperPrint = (JasperReport) JRLoader .loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint .getName() + EXTENSION_XLS); JRXlsExporter exporter = new JRXlsExporter(); exporter .setParameter(JRExporterParameter.JASPER_PRINT, report); exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString()); exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET,Boolean.FALSE); exporter.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND,Boolean.FALSE); exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,Boolean.TRUE); exporter.exportReport();
×
×
  • Create New...