本文整理汇总了Java中net.sf.dynamicreports.report.exception.DRException类的典型用法代码示例。如果您正苦于以下问题:Java DRException类的具体用法?Java DRException怎么用?Java DRException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DRException类属于net.sf.dynamicreports.report.exception包,在下文中一共展示了DRException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: exportDoc
import net.sf.dynamicreports.report.exception.DRException; //导入依赖的package包/类
public void exportDoc(JasperReportBuilder report) throws FileNotFoundException {
try {
// 生成PDF文件
report.toDocx(new FileOutputStream("d:/test/report.docx"));
report.toImage(new FileOutputStream("d:/test/report.png"), ImageType.PNG);
report.toPdf(new FileOutputStream("d:/test/report.pdf"));
report.toXlsx(new FileOutputStream("d:/test/report.xlsx"));
// report.toHtml(new FileOutputStream("d:/test/report.html"))
;
JasperHtmlExporterBuilder htmlExporter = export.htmlExporter(new FileOutputStream("d:/test/report.html"))
.setImagesURI("image?image=");
report.toHtml(htmlExporter);
// 显示报表
report.show();
} catch (DRException e) {
e.printStackTrace();
}
}
示例2: generate
import net.sf.dynamicreports.report.exception.DRException; //导入依赖的package包/类
@VisibleForTesting
@NotNull
static JasperReportBuilder generate(@NotNull final SequencedPatientReport report) throws IOException, DRException {
final EvidenceReportData evidenceReportData = ImmutableEvidenceReportData.of(report.civicAlterations());
// @formatter:off
final VerticalListBuilder totalReport = cmp.verticalList(
MainPageTopSection.build("HMF Civic Evidence Supplement", report.sampleReport()),
cmp.verticalGap(SECTION_VERTICAL_GAP),
cmp.text("Knowledgebase drug association of reported genomic alterations").setStyle(sectionHeaderStyle().setFontSize(15)),
cmp.verticalGap(SECTION_VERTICAL_GAP),
conciseEvidenceSection(),
cmp.verticalGap(SECTION_VERTICAL_GAP),
cmp.text("Civic matching variants").setStyle(sectionHeaderStyle()),
cmp.verticalGap(SECTION_VERTICAL_GAP),
civicMatchingVariantsTable(),
cmp.verticalGap(SECTION_VERTICAL_GAP));
// @formatter:on
return report().addDetail(totalReport).setDataSource(evidenceReportData.toDataSource());
}
示例3: getOS
import net.sf.dynamicreports.report.exception.DRException; //导入依赖的package包/类
/**
* Preparing an output stream of the generated PDF invoice.
*
* @return
*/
public OutputStream getOS(ServletContext context, OutputStream outputStream) {
parameters.put("IMAGE_PATH", context.getRealPath("/jasper/invoices"));
InputStream is = context.getResourceAsStream("/jasper/invoices/" + invoiceName);
try {
report().setTemplateDesign(is)
.setDataSource(beanCollectionDataSource)
.setParameters(parameters).toPdf(outputStream);
} catch (DRException e) {
e.printStackTrace();
}
return outputStream;
}
示例4: concatenatedExportTest
import net.sf.dynamicreports.report.exception.DRException; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Test
public void concatenatedExportTest() {
try {
concatenatedReport.toPng(new ByteArrayOutputStream());
concatenatedReport.toCsv(new ByteArrayOutputStream());
concatenatedReport.toDocx(new ByteArrayOutputStream());
concatenatedReport.toHtml(new ByteArrayOutputStream());
concatenatedReport.toOds(new ByteArrayOutputStream());
concatenatedReport.toOdt(new ByteArrayOutputStream());
concatenatedReport.toPdf(new ByteArrayOutputStream());
concatenatedReport.toRtf(new ByteArrayOutputStream());
concatenatedReport.toText(new ByteArrayOutputStream());
concatenatedReport.toXhtml(new ByteArrayOutputStream());
concatenatedReport.toExcelApiXls(new ByteArrayOutputStream());
concatenatedReport.toXls(new ByteArrayOutputStream());
concatenatedReport.toXlsx(new ByteArrayOutputStream());
concatenatedReport.toXml(new ByteArrayOutputStream());
concatenatedReport.toPptx(new ByteArrayOutputStream());
} catch (DRException e) {
e.printStackTrace();
Assert.fail(e.getMessage());
}
}
示例5: build
import net.sf.dynamicreports.report.exception.DRException; //导入依赖的package包/类
private void build() {
TextColumnBuilder<String> itemColumn = col.column("Item", "item", type.stringType());
TextColumnBuilder<Integer> quantityColumn = col.column("Quantity", "quantity", type.integerType());
TextColumnBuilder<BigDecimal> priceColumn = col.column("Unit price", "unitprice", type.bigDecimalType());
try {
report()
.setTemplate(Templates.reportTemplate)
.columns(
itemColumn, quantityColumn, priceColumn)
.noData(Templates.createTitleComponent("NoData"), cmp.text("There is no data"))
.setDataSource(createDataSource())
.show();
} catch (DRException e) {
e.printStackTrace();
}
}
示例6: getPrintList
import net.sf.dynamicreports.report.exception.DRException; //导入依赖的package包/类
@Override
public List<JasperPrint> getPrintList() throws DRException {
List<JasperPrint> printList = new ArrayList<JasperPrint>();
int pageNumber = 1;
for (JasperReportBuilder jasperReportBuilder : jasperReportBuilders) {
if (continuousPageNumbering) {
jasperReportBuilder.setStartPageNumber(pageNumber);
}
else {
jasperReportBuilder.setStartPageNumber(null);
}
JasperPrint jasperPrint = jasperReportBuilder.toJasperPrint();
printList.add(jasperPrint);
pageNumber += jasperPrint.getPages().size();
}
return printList;
}
示例7: test
import net.sf.dynamicreports.report.exception.DRException; //导入依赖的package包/类
@Test
public void test() {
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
bos = new ByteArrayOutputStream();
concatenatedReport.toCsv(bos);
Assert.assertEquals("concatenated report ", "text1\n1\ntext2\n2\ntext3\n3\n", new String(bos.toByteArray()));
concatenatedReport.setContinuousPageNumbering(false);
bos = new ByteArrayOutputStream();
concatenatedReport.toCsv(bos);
Assert.assertEquals("concatenated report ", "text1\n1\ntext2\n2\ntext3\n3\n", new String(bos.toByteArray()));
} catch (DRException e) {
e.printStackTrace();
Assert.fail(e.getMessage());
}
}
示例8: rebuild
import net.sf.dynamicreports.report.exception.DRException; //导入依赖的package包/类
public JasperReportBuilder rebuild() throws DRException {
builded = false;
reportDesign = null;
jasperDesign = null;
jasperReport = null;
parameters = null;
jasperPrint = null;
if (dataSource != null && dataSource instanceof JRRewindableDataSource) {
try {
((JRRewindableDataSource) dataSource).moveFirst();
} catch (JRException e) {
throw new DRException(e);
}
}
return this;
}
示例9: build
import net.sf.dynamicreports.report.exception.DRException; //导入依赖的package包/类
private void build() {
CustomGroupBuilder yearGroup = grp.group(new YearExpression());
try {
report()
.setTemplate(Templates.reportTemplate)
.columns(
col.column("Order date", "orderdate", type.stringType()),
col.column("Item", "item", type.stringType()),
col.column("Quantity", "quantity", type.integerType()),
col.column("Unit price", "unitprice", type.bigDecimalType()))
.groupBy(yearGroup)
.title(Templates.createTitleComponent("CustomGroup"))
.pageFooter(Templates.footerComponent)
.setDataSource(createDataSource())
.show();
} catch (DRException e) {
e.printStackTrace();
}
}
示例10: build
import net.sf.dynamicreports.report.exception.DRException; //导入依赖的package包/类
private void build() {
TextColumnBuilder<String> countryColumn = col.column("Country", "country", type.stringType());
TextColumnBuilder<String> itemColumn = col.column("Item", "item", type.stringType());
try {
report()
.setTemplate(Templates.reportTemplate)
.tableOfContents()
.columns(
countryColumn,
itemColumn,
col.column("Order date", "orderdate", type.dateType()),
col.column("Quantity", "quantity", type.integerType()),
col.column("Unit price", "unitprice", type.bigDecimalType()))
.groupBy(countryColumn, itemColumn)
.title(Templates.createTitleComponent("TableOfContents1"))
.pageFooter(Templates.footerComponent)
.setDataSource(createDataSource())
.show();
} catch (DRException e) {
e.printStackTrace();
}
}
示例11: transformSort
import net.sf.dynamicreports.report.exception.DRException; //导入依赖的package包/类
private void transformSort(DRISort sort) throws DRException {
DRIDesignExpression expression = transformExpression(sort.getExpression());
DRIDesignExpression sortExpression;
if (expression instanceof DRIDesignField || expression instanceof DRIDesignVariable) {
sortExpression = expression;
}
else {
@SuppressWarnings({ "rawtypes", "unchecked" })
DRVariable variable = new DRVariable(sort.getExpression(), Calculation.NOTHING);
variable.setResetType(Evaluation.NONE);
sortExpression = transformExpression(variable);
}
DRDesignSort designSort = new DRDesignSort();
designSort.setExpression(sortExpression);
designSort.setOrderType(sort.getOrderType());
sorts.add(designSort);
}
示例12: build
import net.sf.dynamicreports.report.exception.DRException; //导入依赖的package包/类
private void build() {
TextColumnBuilder<String> itemColumn = col.column("Item", "item", type.stringType())
.setStyle(stl.templateStyle("style1"));
TextColumnBuilder<Date> orderDateColumn = col.column("Order date", "orderdate", type.dateType())
.setStyle(stl.templateStyle("style2"));
TextColumnBuilder<Integer> quantityColumn = col.column("Quantity", "quantity", type.integerType());
TextColumnBuilder<BigDecimal> unitPriceColumn = col.column("Unit price", "unitprice", type.bigDecimalType());
try {
report()
.templateStyles(stl.loadStyles(TemplateStyleFileReport.class.getResource("TemplateStyles.jrtx")))
.setColumnStyle(stl.templateStyle("columnStyle"))
.setColumnTitleStyle(stl.templateStyle("columnTitleStyle"))
.columns(
itemColumn, orderDateColumn, quantityColumn, unitPriceColumn)
.title(Templates.createTitleComponent("TemplateStyleFile"))
.pageFooter(Templates.footerComponent)
.setDataSource(createDataSource())
.show();
} catch (DRException e) {
e.printStackTrace();
}
}
示例13: transform
import net.sf.dynamicreports.report.exception.DRException; //导入依赖的package包/类
private DRDesignChart transform(DRIChart chart, DRIDataset subDataset, ResetType resetType, DRDesignGroup resetGroup) throws DRException {
DRDesignChart designChart = new DRDesignChart();
designChart.setWidth(accessor.getTemplateTransform().getChartWidth(chart));
designChart.setHeight(accessor.getTemplateTransform().getChartHeight(chart));
designChart.setChartType(chart.getChartType());
designChart.setTheme(accessor.getTemplateTransform().getChartTheme(chart));
if (!(chart.getPlot() instanceof DRIMultiAxisPlot)) {
designChart.setDataset(dataset(chart.getDataset(), subDataset, resetType, resetGroup));
}
designChart.setPlot(plot(chart.getPlot(), designChart.getCustomizers(), chart.getDataset().getSubDataset(), resetType, resetGroup));
designChart.setTitle(title(chart.getTitle()));
designChart.setSubtitle(subtitle(chart.getSubtitle()));
designChart.setLegend(legend(chart.getLegend()));
if (!chart.getCustomizers().isEmpty()) {
designChart.getCustomizers().addAll(chart.getCustomizers());
}
return designChart;
}
示例14: test
import net.sf.dynamicreports.report.exception.DRException; //导入依赖的package包/类
@Test
public void test() {
ReportBuilder<?> rb = new DesignReportBuilder();
configureReport(rb);
try {
DRDesignReport report = new DRDesignReport(rb.getReport());
titleBandTest(report.getTitleBand());
pageHeaderBandTest(report.getPageHeaderBand());
pageFooterBandTest(report.getPageFooterBand());
columnHeaderBandTest(report.getColumnHeaderBand());
columnFooterBandTest(report.getColumnFooterBand());
for (DRDesignBand designBand : report.getDetailBands()) {
detailBandTest(designBand);
}
lastPageFooterBandTest(report.getLastPageFooterBand());
summaryBandTest(report.getSummaryBand());
noDataBandTest(report.getNoDataBand());
backgroundBandTest(report.getBackgroundBand());
} catch (DRException e) {
e.printStackTrace();
Assert.fail(e.getMessage());
}
}
示例15: build
import net.sf.dynamicreports.report.exception.DRException; //导入依赖的package包/类
private void build() {
TextColumnBuilder<String> itemColumn = col.column("Item", "item", type.stringType());
TextColumnBuilder<Integer> quantityColumn = col.column("Quantity", "quantity", type.integerType());
TextColumnBuilder<BigDecimal> priceColumn = col.column("Unit price", "unitprice", type.bigDecimalType());
try {
report()
.setTemplate(Templates.reportTemplate)
.columns(
itemColumn, quantityColumn, priceColumn)
.title(Templates.createTitleComponent("Virtualizer"))
.pageFooter(Templates.footerComponent)
.setDataSource(createDataSource())
.setVirtualizer(new JRFileVirtualizer(2))
.show();
} catch (DRException e) {
e.printStackTrace();
}
}