Your SlideShare is downloading. ×
0
Come Esportare un report in pdf [jasperreports][java][santi caltabiano]
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Come Esportare un report in pdf [jasperreports][java][santi caltabiano]

608

Published on

Come Esportare un report in pdf [jasperreports][java][santi caltabiano]

Come Esportare un report in pdf [jasperreports][java][santi caltabiano]

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
608
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Santi Caltabiano Come Esportare un report in PDFLe seguenti righe di codice mostrano come esportare un report in formato pdf. Nell’esempio di utilizza una connessione con MySql (ma quantodetto vale per qualunque db). Nel codice si considera un report di nome report1.jasper posto nella cartella c:/reports. Il pdf creato avrà il nomereport1.pdf // Carica il driver Class.forName("com.mysql.jdbc.Driver").newInstance(); // Connessione a Mysql Connection cnn = DriverManager.getConnection("jdbc:mysql://localhost:3306/dbname","root","password"); HashMap hm=new HashMap(); // Riempie il report template (file jasper) con i dati JasperPrint print=JasperFillManager.fillReport("C:/reports/report1.jasper", hm, cnn); // Esporta in pdf JRExporter exporter=new JRPdfExporter(); exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, "C:/reports/report1.pdf"); exporter.setParameter(JRExporterParameter.JASPER_PRINT, print); exporter.exportReport(); // Chiude la connessione cnn.close();

×