som
13-05-2008, 09:30
Salve a tutti.
con queste righe di codice creo un report in pdf :
JasperReport jasperReport = JasperCompileManager.compileReport(reportSource);
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, new JRTableModelDataSource((DefaultTableModel)Tabella.getModel()));
JasperExportManager.exportReportToPdfFile(jasperPrint, reportDest);
if (MostraPdf == 1) {
try {
Process p = Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + reportDest);
p.waitFor();
System.out.println("Done.");
}
catch (Exception e) {
JOptionPane.showMessageDialog(null, "!!!!!!");
}
}
Ho un problema quando l'Acrobat Reader è già aperto con il file in questione.
L'ambiente IDE mi dice giustamente che il file è già utilizzato da un altro processo e mi segnala l'errore alla riga
JasperExportManager.exportReportToPdfFile(jasperPrint, reportDest);
Si riesce a chiudere il file aperto nell'Acrobat Reader con una Runtime? Qualcuno ha qualche buon consiglio da darmi? :D
Grazie a tutti in ogni caso
con queste righe di codice creo un report in pdf :
JasperReport jasperReport = JasperCompileManager.compileReport(reportSource);
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, new JRTableModelDataSource((DefaultTableModel)Tabella.getModel()));
JasperExportManager.exportReportToPdfFile(jasperPrint, reportDest);
if (MostraPdf == 1) {
try {
Process p = Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + reportDest);
p.waitFor();
System.out.println("Done.");
}
catch (Exception e) {
JOptionPane.showMessageDialog(null, "!!!!!!");
}
}
Ho un problema quando l'Acrobat Reader è già aperto con il file in questione.
L'ambiente IDE mi dice giustamente che il file è già utilizzato da un altro processo e mi segnala l'errore alla riga
JasperExportManager.exportReportToPdfFile(jasperPrint, reportDest);
Si riesce a chiudere il file aperto nell'Acrobat Reader con una Runtime? Qualcuno ha qualche buon consiglio da darmi? :D
Grazie a tutti in ogni caso