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

Umakanth

Members
  • Posts

    3
  • Joined

  • Last visited

Umakanth's Achievements

Newbie

Newbie (1/14)

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

Recent Badges

0

Reputation

  1. hi thanx for the reply. Ya. iam not an expert in java. I want to export some data to excel. i managed to export to pdf(code is not in this format). I want the same to export to excel to the end user... i am using office 2007 version. pls help...
  2. Hi. I am using ireport 2.0.0. I want some data to be exported to excel(2007 version). But empty excel is getting generated.. Can anyone help in this regard ? I use the below code in my jsp using scriptlet. File reportFile = new File(getServletConfig().getServletContext() .getRealPath("/jasper/TrendAnalysisReportExcel.jrxml")); InputStream input= new FileInputStream(reportFile); JasperDesign design = JRXmlLoader.load(input); JasperReport report = JasperCompileManager.compileReport(design); String startDate = (String)request.getParameter("startDate"); String endDate = (String)request.getParameter("endDate"); String bUnit = (String)request.getParameter("bUnit"); String customer = (String)request.getParameter("customer"); Map<String,Object> parameters = new HashMap<String,Object>(); parameters.put("P_StartDate", new java.util.Date(startDate)); parameters.put("P_EndDate", new java.util.Date(endDate) ); parameters.put("P_BU_UNIT_CODE", bUnit ); parameters.put("P_CU_COMPANY_CODE", customer ); Connection conn = ConnectionManager.getConnection(); JasperPrint print = JasperManager.fillReport(report, parameters, conn); ByteArrayOutputStream output = new ByteArrayOutputStream(); OutputStream outputfile= new FileOutputStream(new File(getServletConfig().getServletContext() .getRealPath("/spooler/Testing.xls"))); JExcelApiExporter exporterXLS = new JExcelApiExporter(); response.setContentType("application/vnd.ms-excel"); exporterXLS.setParameter(JExcelApiExporterParameter.JASPER_PRINT, print); exporterXLS.setParameter(JExcelApiExporterParameter.OUTPUT_STREAM, output); exporterXLS.setParameter(JExcelApiExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE); exporterXLS.setParameter(JExcelApiExporterParameter.IS_DETECT_CELL_TYPE, Boolean.TRUE); exporterXLS.setParameter(JExcelApiExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE); exporterXLS.setParameter(JExcelApiExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE); exporterXLS.exportReport(); cool regards, uk :(
  3. Hi. I am using ireport 2.0.0. I want some data to be exported to excel(2007 version). I use the below code in my jsp using scriptlet. i am not able to do so. empty excel is getting generated.. Can anyone help in this regard ? File reportFile = new File(getServletConfig().getServletContext() .getRealPath("/jasper/TrendAnalysisReportExcel.jrxml")); InputStream input= new FileInputStream(reportFile); JasperDesign design = JRXmlLoader.load(input); JasperReport report = JasperCompileManager.compileReport(design); String startDate = (String)request.getParameter("startDate"); String endDate = (String)request.getParameter("endDate"); String bUnit = (String)request.getParameter("bUnit"); String customer = (String)request.getParameter("customer"); Map<String,Object> parameters = new HashMap<String,Object>(); parameters.put("P_StartDate", new java.util.Date(startDate)); parameters.put("P_EndDate", new java.util.Date(endDate) ); parameters.put("P_BU_UNIT_CODE", bUnit ); parameters.put("P_CU_COMPANY_CODE", customer ); Connection conn = ConnectionManager.getConnection(); JasperPrint print = JasperManager.fillReport(report, parameters, conn); ByteArrayOutputStream output = new ByteArrayOutputStream(); OutputStream outputfile= new FileOutputStream(new File(getServletConfig().getServletContext() .getRealPath("/spooler/Testing.xls"))); JExcelApiExporter exporterXLS = new JExcelApiExporter(); response.setContentType("application/vnd.ms-excel"); exporterXLS.setParameter(JExcelApiExporterParameter.JASPER_PRINT, print); exporterXLS.setParameter(JExcelApiExporterParameter.OUTPUT_STREAM, output); exporterXLS.setParameter(JExcelApiExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE); exporterXLS.setParameter(JExcelApiExporterParameter.IS_DETECT_CELL_TYPE, Boolean.TRUE); exporterXLS.setParameter(JExcelApiExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE); exporterXLS.setParameter(JExcelApiExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE); exporterXLS.exportReport(); cool regards, uk
×
×
  • Create New...