-1

I have an RCP application, and it has worked fine ...until now.

I have to upgrade some modules that read and write xlsm and xlsx files, so I upgrade poi.

But it breaks my JasperReport reports, the version was very old, 2.0.3, so I try to upgraded also, to 6.1.0, which contains the version of poi that I need.

But I can't make it work inside the viewpart.

This is how it look now, with jasperreports2.0.3

how it looks now

The export /save as button doesn't work, with this error:

net.sf.jasperreports.engine.JRPrintHyperlink.getHyperlinkType()

googled and I got the hint to upgrade and use JRViewer.

I tried to follow this question: how to print jasper report in Eclipse RCP using its print option? but I didn't get it work.

Can someone give me some clues?

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Nicolas400
  • 85
  • 15

1 Answers1

0

I got it! ... Modified CreatePartControl...

public void createPartControl(Composite parent) {
Composite container = new Composite(parent, SWT.NONE);
container.setLayout(new FillLayout(SWT.HORIZONTAL));
//viewerComposite = new ViewerComposite(container,SWT.BORDER);
//viewerComposite.setLayoutData(new GridData(GridData.FILL,GridData.FILL,true,true));

//desde aca
//add the SWT_AWT compposite for SWING contents of GUI              
final Composite swtAwtComposite = new Composite(container, SWT.EMBEDDED);
swtAwtComposite.setBounds(10, 0, 767, 600);

Frame frame = SWT_AWT.new_Frame(swtAwtComposite);

Panel panel = new Panel();
frame.add(panel);
panel.setLayout(new BorderLayout(0, 0));

JRootPane rootPane = new JRootPane();
rootPane.setSize(767, 600);
panel.add(rootPane);

//Define a container yourself
c = rootPane.getContentPane();


super.setPartName("Reportes");

}

I pass the JasperPrint object from other View, so I created a void method...

public void setJasperPrint(JasperPrint jrPrint){
    this.jrPrint = jrPrint;
    //
    jasperviewer = new JRViewer(jrPrint);

    //Add the JRViewer object onto the container to render in GUI
    c.add(jasperviewer);

}

works like a charm!

new look ! but it works

new look! But it works!

Best Regards

Nicolas400
  • 85
  • 15