动态报表操作

public class MyReport {

public MyReport() {

try {

JasperDesign j = JRXmlLoader.load("D:/rpt_05.jrxml");
JRDesignDataset set = j.getMainDesignDataset();

List<JRDesignGroup> groupsList = set.getGroupsList();

JRDesignGroup myGroupsHeader = null;
for (JRDesignGroup designGroup : groupsList) {

if ("myGroup".equals(designGroup.getName())) {
myGroupsHeader = designGroup;
break;
}

}
JRDesignTextField element = (JRDesignTextField) myGroupsHeader.getGroupHeader().getElementByKey("textField-66");

JasperDesignViewer.viewReportDesign(j);

} catch (JRException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}

}

public static void main(String[] args) {

new MyReport();

}

}

你可能感兴趣的:(J#)