Jump to content
JasperReports Library 7.0 is now available ×

how to convert bytes from report to string


2004 IR Help

Recommended Posts

By: huygens - charlesdsouza

how to convert bytes from report to string

2005-12-09 12:50

I make the following code to get the bytes of the report and convert it to string,

ResultSet rs = stmt.executeQuery(sql);

JRResultSetDataSource jrrs = new JRResultSetDataSource(rs);

Map param = new HashMap();

String jasperFileName = path+"\"+ nome+ext;

 

byte[] bytes = JRLoader.loadBytes(new File(jasperFileName));

 

but when I write in this string to a file, and then use jrviewer to load this file occurs an JRException (StreamCorruptedException). the loader code is folowing:

 

 

JRViewer v = new JRViewer(fileName, arg1);

FileInputStream fis = new FileInputStream(new File(fileName));

v.loadReport(fis, arg1);

fis.close();

 

 

how I could load the file correctly??

Thanks for some help?

Souza, CD.

 

 

 

 

By: huygens - charlesdsouza

how to convert bytes from report ... again

2005-12-10 14:08

none answers yet, let me explain again the problem.

I have an application using Tomcat 5, and Java 1.5, when the user push a button to make a report, I get a ResultSet to fill it from the oracle, and show the report in the screen using the jasperviewer interface.

I found a way to make it, getting the bytes of the report using the loadbytes method, and converting these bytes to a string that is passed as a parameter for the applet, then this applet write the file into the userhome directory, and load the jasperviewer showing this report,

But I'm not able to write this file yet using the code above.

Can someone help to solve it, please.

If it isn't undertandable yet, I can explain again.

thank.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...