To achieve this you have to create a Report object.
Report report = new Report();The only thing you have to do is to create the ReportLayout:
report.setName("Report File Name");
report.setSql("select ...");
report.setLayout(createLayout(columnNames, "Title"));
public static ReportLayout createLayout(List<String> columnNames, String title) {This is the method used by "New Report" action from designer. You can choose any template properties to add on your BandElement cells.
ReportLayout reportLayout = new ReportLayout();
reportLayout.setReportType(ResultExporter.DEFAULT_TYPE);
int size = columnNames.size();
// create a row in header band with a title cell spanned on the entire row
Band headerBand = reportLayout.getHeaderBand();
List<BandElement> titleRow = new ArrayList<BandElement>();
BandElement titleElement = new BandElement(title);
titleElement.setColSpan(size);
titleElement.setHorizontalAlign(BandElement.CENTER);
titleElement.setVerticalAlign(BandElement.MIDDLE);
titleElement.setPadding(new Padding(1,1,1,1));
titleRow.add(titleElement);
for (int i = 0; i < size - 1; i++) {
titleRow.add(null);
}
List<List<BandElement>> headerElements = new ArrayList<List<BandElement>>();
headerElements.add(titleRow);
// create two rows in detail band:
// first with column names and second with ColumnBandElement cells
Band detailBand = reportLayout.getDetailBand();
List<BandElement> headerNamesRow = new ArrayList<BandElement>(size);
List<bandelement> headerFieldsRow = new ArrayList<BandElement>(size);
for (String column : columnNames) {
BandElement he = new BandElement(column);
he.setPadding(new Padding(1,1,1,1));
headerNamesRow.add(he);
BandElement ce = new ColumnBandElement(column);
ce.setPadding(new Padding(1,1,1,1));
headerFieldsRow.add(ce);
}
List<List<BandElement>> detailElements = new ArrayList<List<BandElement=>>();
headerElements.add(headerNamesRow);
detailElements.add(headerFieldsRow);
// create an empty footer row
Band footerBand = reportLayout.getFooterBand();
List<List<BandElement>> footerElements = new ArrayList<List<BandElement>>();
List<BandElement> footerRow = new ArrayList<BandElement>();
for (int i = 0; i < size; i++) {
footerRow.add(new BandElement(""));
}
footerElements.add(footerRow);
headerBand.setElements(headerElements);
detailBand.setElements(detailElements);
footerBand.setElements(footerElements);
return reportLayout;
}
After creating the report you can run it using the engine api or you can save it using any ro.nextreports.engine.util.ReportUtil save methods.
IEEE Final Year projects Project Centers in Chennai are consistently sought after. Final Year Students Projects take a shot at them to improve their aptitudes. IEEE Final Year project centers ground for all fragments of CSE & IT engineers hoping to assemble.Final Year Projects for CSE
ReplyDeleteSpring Framework has already made serious inroads as an integrated technology stack for building user-facing applications. Spring Framework Corporate TRaining .
Specifically, Spring Framework provides various tasks are geared around preparing data for further analysis and visualization. Spring Training in Chennai
The Angular Training covers a wide range of topics including Angular Directives, Angular Services, and Angular programmability.Angular Training