Jump to content
Changes to the Jaspersoft community edition download ×

Custom DataSource for iReport and Tablemodel


Recommended Posts

Hi jasper friends !!


I have a problem creating a custom datasource because I want to use a tableModel as datasource in iReport. I don't need a SQL query because I have a tableModel with all the data.



The source code in my class "CreateReport" is :




//Ruta de Archivo Jasper

String fileName = "C:Archivos de programaMiDirArchivo.jasper";


//Pasamos parametros al reporte Jasper.

Map parameters = new HashMap();


parameters.put("colNombreEmpInf",tableModelEmp.getValueAt(0, 0));

parameters.put("colPassEmpInf",tableModelEmp.getValueAt(0, 1));


//Se establece la fuente de datos, que será una Tabla

JRTableModelDataSource Tabledata = new JRTableModelDataSource(tableModelEmp);


//Preparacion del reporte (en esta etapa llena el diseño de reporte)

//Reporte diseñado y compilado con iReport

//Se envia Modelo de tabla con datos en lugar de una conexion

JasperPrint jasperPrint = JasperFillManager.fillReport(fileName,parameters,Tabledata);


//Se lanza el Viewer de Jasper

JasperViewer jviewer = new JasperViewer(jasperPrint,false);



catch (Exception j)


JOptionPane.showMessageDialog(null,"Mensaje de Error:"+j.getMessage(),





I think that this code is OK. If not, please give me an answer.


If someone know how to use iReport 1.3.3 or another version PLEASE answer me. I'm driving crazy with this problem.



Thanks a lot for reading!

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