Jump to content
Changes to the Jaspersoft community edition download ×

apurbakarfa007

Members
  • Posts

    1
  • Joined

  • Last visited

apurbakarfa007's Achievements

Newbie

Newbie (1/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. I am using two java swing Jtable, which hold some data and i want to print them, but i did not understand how to print two table one by one.Pleae help me... //This is my Codeprivate void print() { try { List numdata = new ArrayList(); //jtdName First Java Swing Jtable. for (int count = 0; count < jtdName.getRowCount(); count++) { for (int cl = 0; cl < jtdName.getColumnCount(); cl++) { numdata.add(jtdName.getValueAt(count, cl).toString()); } } //jtbClass Second Java Swing Jtable. List classdata = new ArrayList(); for (int count = 0; count < jtbClass.getRowCount(); count++) { for (int cl = 0; cl < jtbClass.getColumnCount(); cl++) { classdata.add(jtbClass.getValueAt(count, cl).toString()); } } ArrayList<Object> datalist = new ArrayList(); datalist.add(numdata); datalist.add(classdata); String reportSource = "\TablePrint\src\print\PrintView.jrxml"; String reportDest = "\TablePrint\src\print\PrintView.jasper"; JasperReport jasperReport = JasperCompileManager.compileReport(reportSource); JRBeanCollectionDataSource beanColDataSource = new JRBeanCollectionDataSource(datalist); JasperPrint jasperPrint; jasperPrint = JasperFillManager.fillReport(jasperReport, null, beanColDataSource); JasperExportManager.exportReportToHtmlFile( jasperPrint, reportDest); JasperViewer.viewReport(jasperPrint, false); } catch (JRException e) { } }
×
×
  • Create New...