 |
|
*แก้ไข* Java เกี่ยวกับ jasper report ส่ง..Datasource จาก DB เข้าไป แต่ทำไมมันไม่สร้าง file pdf ให้ ฯ ช่วยหน่อยค่ะ |
|
 |
|
|
 |
 |
|
สงสัยคำถามจะยากมากเลย 555+
|
 |
 |
 |
 |
Date :
2014-09-04 14:00:43 |
By :
linping |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อยากดู log อะครับ แบบนี้ผมก็ไม่รู้อะ
|
 |
 |
 |
 |
Date :
2014-09-04 16:32:24 |
By :
ortree01 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ได้แล้วค่ะตอนนี้..แต่ปัญหาใหม่คือ มันไม่เห็นจะสร้างไฟล์ pdf ให้เลย นี่สิ...ฯ โค๊ตตามนี้เลยค่ะ เปลี่ยนไงก้..แล้ว ก็..ยังเหมือนเดิม ฯ ต้องทำไงค่ะ
ขอคุณค่ะ ฯฯ
Code (Java)
String filePath = "C:\\Users\\peangter\\Documents\\workspace\\Querying\\jasperreport\\testReportQuery.jrxml";
//System.out.print(filePath);
Map para = new HashMap();
//jasperRealPath = servletContext.getRealPath(JASPER_REPORT_PATH + jasperName);
JasperReport jasperReport = JasperCompileManager.compileReport(filePath);
JRBeanCollectionDataSource dataSource = new JRBeanCollectionDataSource(items);
JasperPrint jPrint = JasperFillManager.fillReport(filePath,param,dataSource);
//JasperViewer.viewReport(jPrint);
JasperExportManager.exportReportToPdfFile(jPrint,"jasperreport/reportProduct.pdf");
.
หาที่ไหนก็ไม่เจอค่ะ อยากให้มันอยู่ที่เดียวกัน กับ ไฟล์.... C:\\Users\\peangter\\Documents\\workspace\\Querying\\jasperreport\\testReportQuery.jrxml
ตอน exportReportToPdfFile ใส่ path จิง นำหน้าแล้วก็ยังไม่เหนจะสร้างไ ฟล์ pdf ให้เลยค่ะ ฯ ขอบคุณค่ะ !!!
|
ประวัติการแก้ไข 2014-09-04 19:37:18 2014-09-04 19:38:57 2014-09-04 19:40:57 2014-09-04 19:43:05
 |
 |
 |
 |
Date :
2014-09-04 19:36:20 |
By :
linping |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|

|
 |
 |
 |
 |
Date :
2014-09-05 09:33:00 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แบบนี้ขึ้นมาเลย
ลองเอาไปแปลงดูครับ
Code (Java)
File reportFile = new File(application.getRealPath("report/mmreport.jasper"));
byte[] bytes = JasperRunManager.runReportToPdf(reportFile.getPath(), Jparam, new JREmptyDataSource());
response.setContentType("application/pdf");
response.setContentLength(bytes.length);
ServletOutputStream outputStream = response.getOutputStream();
outputStream.write(bytes, 0, bytes.length);
outputStream.flush();
outputStream.close();
|
ประวัติการแก้ไข 2014-09-05 13:56:12
 |
 |
 |
 |
Date :
2014-09-05 13:55:26 |
By :
ortree01 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
1. ผมอยากให้ลอง check Class path ใน jasper design ครับ ว่าอ้างไปถึง method ที่ว่าไหม
2. แค่เนี่ยเละ
|
 |
 |
 |
 |
Date :
2014-09-06 20:21:27 |
By :
ortree01 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ได้แล้วค่ะตอนนี้....เปลี่ยนแปลงใน บรรทัดนี้
Code (Java)
JRBeanCollectionDataSource jrDatasouce = new JRBeanCollectionDataSource(itemsList, false);
แต่ปัญหาใหม่คือ...มันไม่แสดง title ทั้งๆที่ถ้า run ใน ireport หรือ ตอนใช้ JRViewer มันก็..แสดงปกติ
แต่ใน pdf ที่แปลงมาได้แบนี้ ฯฯ งง ป่ะ ปัญหาเยอะจิงๆค่ะ 555+ (ใครเจอปัญหานี้บ้างเ่อย ?)

|
ประวัติการแก้ไข 2014-09-07 14:25:39 2014-09-07 14:27:24
 |
 |
 |
 |
Date :
2014-09-07 14:24:30 |
By :
linping |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|