Jump to content
We've recently updated our Privacy Statement, available here ×

Exporter Parameter + JasperViewer


thiagot

Recommended Posts

Hello,

 

I need a hand here.

 

My application is using JasperViewer but his XLS exporter isn't working well. The cells with any pattern (dd/MM/yyyy or ###0,00) comes with a single quote before the value in XLS (like '04/10/1999).

 

I made a code that sets the IS_DETECT_CELL_TYPE to true (exporter.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE, true) and generated a XLS file with it and worked just fine! :)

 

The problem is that I need to do it using JasperViewer, I must add this parameter to the JasperViewer's XLS exporter. :(

 

Is there any way that can be done?

 

Thanks,

Thiago

Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Hi,

 

You can customize the way documents are exported from the Swing viewer by implementing and then registering a custom "save contributor".

In JasperReports, the reusable viewer component is not exactly the JasperViewer class, but rather the JRViewer panel.

You can instantiate the JRViewer and remove the existing XLS save contributors and add a JRSaveContributor implementation of your own, that would even prompt you for export options using a dialog.

You can try implement your save contributor by looking into the ones we ship with the library by default.

 

I hope this helps.

Teodor

Link to comment
Share on other sites

Hi,

 

First of all, thanks a lot for the reply.

 

One thing, how can I retrieve the reference of the JRViewer within my JasperViewer? So I can get it to call the method addSaveContributor(mySaveContributor).

 

Code:

JasperViewer jrviewer = new JasperViewer(print, false);
jrviewer.setVisible(true);

 

I can't get the reference to the JRViewer in my "jrviewer".

Will I have to change the source of the JRViewer.java and JasperViewer.java?

 

Thanks a lot,

Thiago

Link to comment
Share on other sites

  • 2 weeks later...

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...