java - Dynamic Jasper subreport table border -
hi new dynamicjasper, created sub report when set border using setborder property subreport raise exception java.lang.reflect.invocationtargetexception
this subreport code
public dynamicreport buildreport() throws exception { fastreportbuilder frb = new fastreportbuilder(); frb.settitle("project documentation") .setmargins(5, 5, 20, 20); frb.addcolumn("","project_id", string.class.getname(), 30) .addcolumn("","product_name",string.class.getname(),30) .setquery("select * project_master project_id=$p{project_id}", djconstants.query_language_sql); size = table_name.size(); delete_table = table_name; system.out.println("size = = = "+size); frb.addgroups(2); for(int s=0;s<table_name.size();s++){ system.out.println(" s "+s+" = "+table_name.get(s).tostring()+" s_n "+seciton_name.get(s).tostring()+" tab_type "+table_type.get(s).tostring()); frb.addsubreportingroupheader(2, subreport(table_name.get(s).tostring(),seciton_name.get(s).tostring(),table_type.get(s).tostring()),getlayoutmanager (),"getdatasourcesubreport"+s,djconstants.subreport_parameter_map_origin_parameter,djconstants.data_source_type_jrdatasource); params.put("getdatasourcesubreport"+s, getdatasourcesubreport(table_name.get(s).tostring())); } frb.setprintbackgroundonoddrows(true); frb.setusefullpagewidth(true); params.put("project_id","pjt/0001"); return dr; } public dynamicreport subreport(string tab_name,string tit_name,string tab_type)throws exception{ **style tbl_border = new stryle(); tbl_border.setborder(border.thin());** //***error occured in line*** fastreportbuilder drb1 = new fastreportbuilder(); if(tab_type.equals("textarea")){ int max_width = 0; statement st5 = connection.createstatement(); resultset rs5 = st5.executequery("select column_name information_schema.columns table_name='"+tab_name+"'"); while(rs5.next()){ system.out.println("inside while textarea"); if(max_width>=1){ drb1.addcolumn("",rs5.getstring(1).tostring(),string.class.getname(),25); } max_width++; } drb1.setusefullpagewidth(true); } if(tab_type.equals("table")){ int max_width =0; statement st5 = connection.createstatement(); resultset rs5 = st5.executequery("select column_name information_schema.columns table_name='"+tab_name+"'"); while(rs5.next()){ system.out.println("inside while"); **drb1.addcolumn(rs5.getstring(1).tostring(),rs5.getstring(1).tostring(),string.class.getname(),25)addstyle(tbl_border);** max_width++; } if(max_width>2){ drb1.setusefullpagewidth(true); } } // for(int sg=0;sg<header.size();sg++){ // drb1.addcolumn(header.get(sg).tostring(),header.get(sg).tostring(),string.class.getname(),25); // } drb1.setsubtitle(tit_name); drb1.settitle(""); dynamicreport dr1 = drb1.build(); return dr1; }
in above code set 1 condition if table need exact border table, how can achieve it
its conflict using dyanamicjasper3.0.6 because not containing border class correctly, when u used dynamicjasper 4.0.3 , 3.0.6 in same project consider 3.0.6 not 4.0.3. remove 3.0.6 , use 4.0.3 surely working.
Comments
Post a Comment