J2EEGeneral J2EE (Java 2 Enterprise Edition) discussions. Questions not specific to EE will be redirected elsewhere.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the J2EE section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
Hi I am Using Jasper Reports In my project and i have created .jrxml file and i am able to Export the report in to PDF ( with data) but same code i am not able export in EXCel . The File is getting generated with No data .
public class JasperReportDemo
{
public static void main(String[] args) throws SQLException, FileNotFoundException,
IllegalAccessException, ClassNotFoundException,Exception
{
try
{
final String driverClass = "xxxxxxxxxxxxxxxxxx";
final String connectionURL = "xxxxxxxxxxxx ";
final String userID = "xxxxxxxxxxx";
final String userPassword = "zzzzzzzzzzzz";
Connection con = null;
Statement stmt = null;
ResultSet rset = null;
Class.forName(driverClass).newInstance();
con = DriverManager.getConnection(connectionURL, userID, userPassword);
String queryString = "SELECT STOCKROOM_ID, STOCKROOM_NAME, STOCKROOM_DESC "
+ "FROM stockroom ";
stmt = con.createStatement();
rset = stmt.executeQuery(queryString);
InputStream input = new FileInputStream(new File("c:/stockroom.xml"));
JasperDesign design = JRXmlLoader.load(input);
JasperReport report = JasperCompileManager.compileReport(design);
JRResultSetDataSource jasperReports = new JRResultSetDataSource(rset);
JasperPrint print = JasperFillManager.fillReport(report, new HashMap(), jasperReports);
long start = System.currentTimeMillis();
OutputStream output = new FileOutputStream(new File("c:/output/JasperReport.pdf"));
JasperExportManager.exportReportToPdfStream(print, output);
hi even i am facing with the same problem
i am able to export my jasperReport to PDF.
but when i am exporting it to .xls format
i am only getting textexpressions, static texts i used specifically.
but i am not able to get the imageExpressions.
has any one worked on it and if so what is the solution.
Thanks anveshini..I am able to generate reports in Excel format ...
But I have two issues with display
1)Managing new line characters in an Excel cell
2)Setting the row width
quote:Originally posted by babuchelat
Thanks anveshini..I am able to generate reports in Excel format ...
But I have two issues with display
1)Managing new line characters in an Excel cell
2)Setting the row width
Do you have any idea how to solve this?
Hi,
Did you able to solve the above issues.?
If so, can you please let me know the solution.
HI.. I am using Jasper Reports in my project. I am able to get PDF format but when I try to get output in xls form useing JRXlsExporter i am facing some problem thats given below, my code is just below of problem :-
java.lang.reflect.InvocationTargetException
Caused by: java.lang.NoClassDefFoundError: org/apache/poi/hssf/usermodel/HSSFCellStyle
at com.app.webapp.action.ReportAction.viewReportWithP aram(ReportAction.java:74)