本文整理汇总了Java中net.sf.dynamicreports.report.exception.DRException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java DRException.printStackTrace方法的具体用法?Java DRException.printStackTrace怎么用?Java DRException.printStackTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.dynamicreports.report.exception.DRException
的用法示例。
在下文中一共展示了DRException.printStackTrace方法的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: 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;
}
示例3: build
import net.sf.dynamicreports.report.exception.DRException; //导入方法依赖的package包/类
private void build() {
try {
unitPriceField = field("unitprice", BigDecimal.class);
TextColumnBuilder<String> itemColumn = col.column("Item", "item", type.stringType());
TextColumnBuilder<Integer> quantityColumn = col.column("Quantity", "quantity", type.integerType());
PercentageColumnBuilder quantityPercColumn = col.percentageColumn("Quantity [%]", quantityColumn);
PercentageColumnBuilder unitPricePercColumn = col.percentageColumn("Unit price [%]", unitPriceField);
report()
.setTemplate(Templates.reportTemplate)
.fields(
unitPriceField)
.columns(
itemColumn, quantityColumn, quantityPercColumn, unitPricePercColumn)
.title(Templates.createTitleComponent("PercentageColumns"))
.pageFooter(Templates.footerComponent)
.setDataSource(createDataSource())
.show();
} catch (DRException e) {
e.printStackTrace();
}
}
示例4: test
import net.sf.dynamicreports.report.exception.DRException; //导入方法依赖的package包/类
@Test
public void test() {
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
concatenatedReport.toCsv(bos);
Assert.assertEquals("concatenated report ", "text1\n1\ntext2\n1\ntext3\n1\n", new String(bos.toByteArray()));
concatenatedReport.continuousPageNumbering();
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\n1\ntext3\n1\n", new String(bos.toByteArray()));
} catch (DRException e) {
e.printStackTrace();
Assert.fail(e.getMessage());
}
}
示例5: 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());
}
}
示例6: build
import net.sf.dynamicreports.report.exception.DRException; //导入方法依赖的package包/类
private void build() {
StyleBuilder plainStyle = stl.style()
.setFontName("FreeUniversal");
StyleBuilder boldStyle = stl.style(plainStyle)
.bold();
StyleBuilder italicStyle = stl.style(plainStyle)
.italic();
StyleBuilder boldItalicStyle = stl.style(plainStyle)
.boldItalic();
try {
report()
.title(
Templates.createTitleComponent("Fonts"),
cmp.text("FreeUniversal font - plain").setStyle(plainStyle),
cmp.text("FreeUniversal font - bold").setStyle(boldStyle),
cmp.text("FreeUniversal font - italic").setStyle(italicStyle),
cmp.text("FreeUniversal font - bolditalic").setStyle(boldItalicStyle))
.show();
} catch (DRException e) {
e.printStackTrace();
}
}
示例7: build
import net.sf.dynamicreports.report.exception.DRException; //导入方法依赖的package包/类
private void build() {
try {
JasperHtmlExporterBuilder htmlExporter = export.htmlExporter("c:/report.html")
.setImagesDirName("c:/images")
.setOutputImagesToDir(true);
report()
.setTemplate(Templates.reportTemplate)
.columns(
col.column("Item", "item", type.stringType()),
col.column("Quantity", "quantity", type.integerType()),
col.column("Unit price", "unitprice", type.bigDecimalType()))
.title(Templates.createTitleComponent("HtmlReport"))
.pageFooter(Templates.footerComponent)
.setDataSource(createDataSource())
.toHtml(htmlExporter);
} catch (DRException e) {
e.printStackTrace();
}
}
示例8: build
import net.sf.dynamicreports.report.exception.DRException; //导入方法依赖的package包/类
private void build() {
try {
report()
.setTemplate(Templates.reportTemplate)
.columns(
col.column("Item", "item", type.stringType()),
col.column("Quantity", "quantity", type.integerType()),
col.column("Unit price", "unitprice", type.bigDecimalType()))
.title(Templates.createTitleComponent("DatabaseDatasource"))
.pageFooter(Templates.footerComponent)
.setDataSource("SELECT * FROM sales", connection)
.show();
} catch (DRException e) {
e.printStackTrace();
}
}
示例9: build
import net.sf.dynamicreports.report.exception.DRException; //导入方法依赖的package包/类
private void build() {
try {
report()
.setTemplate(Templates.reportTemplate)
.fields(
field("unitprice", BigDecimal.class))
.columns(
col.column("Item", "item", type.stringType()),
col.column("Quantity", "quantity", type.integerType()),
col.column("Unit price", "unitprice", type.bigDecimalType()).setValueFormatter(new ValueFormatter()))
.title(Templates.createTitleComponent("ValueFormatter"))
.pageFooter(Templates.footerComponent)
.setDataSource(createDataSource())
.show();
} catch (DRException e) {
e.printStackTrace();
}
}
示例10: writeGivingStatement
import net.sf.dynamicreports.report.exception.DRException; //导入方法依赖的package包/类
public static void writeGivingStatement(String lastName, String firstName, File outputFile) throws IOException
{
final FileOutputStream os = new FileOutputStream(outputFile);
try {
final JasperReportBuilder statement = createGivingStatement(lastName, firstName);
statement.toXlsx(os);
} catch (DRException e) {
JOptionPane.showMessageDialog(null, "Exception occurred writing report: " + e.getMessage());
e.printStackTrace();
} finally {
os.flush();
os.close();
}
}
示例11: printGivingStatement
import net.sf.dynamicreports.report.exception.DRException; //导入方法依赖的package包/类
public static void printGivingStatement(String lastName, String firstName)
{
final JasperReportBuilder statement = createGivingStatement(lastName, firstName);
try {
statement.print(true);
} catch (DRException e) {
e.printStackTrace();
}
}
示例12: printReport
import net.sf.dynamicreports.report.exception.DRException; //导入方法依赖的package包/类
private void printReport()
{
try {
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
final JasperReportBuilder report = createReport();
setCursor(Cursor.getDefaultCursor());
report.print(true);
} catch (DRException e) {
e.printStackTrace();
}
}
示例13: saveReport
import net.sf.dynamicreports.report.exception.DRException; //导入方法依赖的package包/类
private void saveReport() throws IOException
{
final FileOutputStream os = new FileOutputStream(outputFile);
try {
createReport().toXlsx(os);
} catch (DRException e) {
e.printStackTrace();
} finally {
os.close();
}
}
示例14: build
import net.sf.dynamicreports.report.exception.DRException; //导入方法依赖的package包/类
private void build() {
URL image = Templates.class.getResource("images/pda.png");
try {
report()
.setTemplate(template().setBarcodeHeight(50))
.setTextStyle(stl.style(stl.pen1Point()))
.title(
Templates.createTitleComponent("Components"),
components(
"rectangle", cmp.rectangle(),
"round rectangle", cmp.roundRectangle(10),
"ellipse", cmp.ellipse()),
cmp.verticalGap(10),
components(
"text field", cmp.text("text"),
"image", cmp.image(image).setFixedDimension(30, 30),
"line", cmp.line()),
cmp.verticalGap(10),
components(
"boolean field", cmp.booleanField(true).setComponentType(BooleanComponentType.IMAGE_CHECKBOX_2).setFixedDimension(20, 20),
"center horizontal", cmp.centerHorizontal(cmp.image(image).setFixedDimension(50, 50)),
"center vertical", cmp.centerVertical(cmp.text("text").setFixedRows(1))),
cmp.verticalGap(10),
components(
"text field", cmp.text("text"),
"empty space", cmp.filler(),
"text field", cmp.text("text")),
cmp.verticalGap(50),
cmp.horizontalList(cmp.text("text"), cmp.horizontalGap(100), cmp.text("text")))
.show();
} catch (DRException e) {
e.printStackTrace();
}
}
示例15: testBackgroundComponents
import net.sf.dynamicreports.report.exception.DRException; //导入方法依赖的package包/类
private void testBackgroundComponents(ReportBuilder<?> rb, Integer ...radius) {
try {
DRDesignReport report = new DRDesignReport(rb.getReport());
DRDesignRectangle rectangle = (DRDesignRectangle) ((DRDesignList) report.getTitleBand().getBandComponent()).getBackgroundComponent();
Assert.assertEquals("title background component", radius[0], rectangle.getRadius());
rectangle = (DRDesignRectangle) ((DRDesignList) report.getPageHeaderBand().getBandComponent()).getBackgroundComponent();
Assert.assertEquals("pageHeader background component", radius[1], rectangle.getRadius());
rectangle = (DRDesignRectangle) ((DRDesignList) report.getPageFooterBand().getBandComponent()).getBackgroundComponent();
Assert.assertEquals("pageFooter background component", radius[2], rectangle.getRadius());
rectangle = (DRDesignRectangle) ((DRDesignList) report.getColumnHeaderBand().getBandComponent()).getBackgroundComponent();
Assert.assertEquals("columnHeader background component", radius[3], rectangle.getRadius());
rectangle = (DRDesignRectangle) ((DRDesignList) report.getColumnFooterBand().getBandComponent()).getBackgroundComponent();
Assert.assertEquals("columnFooter background component", radius[4], rectangle.getRadius());
DRDesignGroup group = new ArrayList<DRDesignGroup>(report.getGroups()).get(0);
rectangle = (DRDesignRectangle) ((DRDesignList) group.getHeaderBands().get(0).getBandComponent()).getBackgroundComponent();
Assert.assertEquals("groupHeader background component", radius[5], rectangle.getRadius());
rectangle = (DRDesignRectangle) ((DRDesignList) group.getFooterBands().get(0).getBandComponent()).getBackgroundComponent();
Assert.assertEquals("groupFooter background component", radius[6], rectangle.getRadius());
rectangle = (DRDesignRectangle) ((DRDesignList) report.getDetailBands().get(0).getBandComponent()).getBackgroundComponent();
Assert.assertEquals("detailHeader background component", radius[7], rectangle.getRadius());
rectangle = (DRDesignRectangle) ((DRDesignList) report.getDetailBands().get(1).getBandComponent()).getBackgroundComponent();
Assert.assertEquals("detail background component", radius[8], rectangle.getRadius());
rectangle = (DRDesignRectangle) ((DRDesignList) report.getDetailBands().get(2).getBandComponent()).getBackgroundComponent();
Assert.assertEquals("detailFooter background component", radius[9], rectangle.getRadius());
rectangle = (DRDesignRectangle) ((DRDesignList) report.getLastPageFooterBand().getBandComponent()).getBackgroundComponent();
Assert.assertEquals("lastPageFooter background component", radius[10], rectangle.getRadius());
rectangle = (DRDesignRectangle) ((DRDesignList) report.getSummaryBand().getBandComponent()).getBackgroundComponent();
Assert.assertEquals("summary background component", radius[11], rectangle.getRadius());
rectangle = (DRDesignRectangle) ((DRDesignList) report.getBackgroundBand().getBandComponent()).getBackgroundComponent();
Assert.assertEquals("background background component", radius[12], rectangle.getRadius());
} catch (DRException e) {
e.printStackTrace();
Assert.fail(e.getMessage());
}
}