1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 package ar.com.fdvs.dj.test;
31
32
33 import java.util.Date;
34
35 import ar.com.fdvs.dj.core.DynamicJasperHelper;
36 import ar.com.fdvs.dj.domain.DynamicReport;
37 import ar.com.fdvs.dj.domain.builders.FastReportBuilder;
38
39 public class JrxmlExportTest extends BaseDjReportTest {
40
41 public DynamicReport buildReport() throws Exception {
42
43
44
45
46
47
48 FastReportBuilder drb = new FastReportBuilder();
49 drb.addColumn("State", "state", String.class.getName(),30)
50 .addColumn("Branch", "branch", String.class.getName(),30)
51 .addColumn("Product Line", "productLine", String.class.getName(),50)
52 .addColumn("Item", "item", String.class.getName(),50)
53 .addColumn("Item Code", "id", Long.class.getName(),30,true)
54 .addColumn("Quantity", "quantity", Long.class.getName(),60,true)
55 .addColumn("Amount", "amount", Float.class.getName(),70,true)
56 .addGroups(2)
57 .setTitle("November " + getYear() +" sales report")
58 .setSubtitle("This report was generated at " + new Date())
59 .setUseFullPageWidth(true);
60
61 DynamicReport dr = drb.build();
62
63 return dr;
64 }
65
66 public void testReport() throws Exception {
67 dr = buildReport();
68 exportReport();
69 log.debug("test finished");
70 }
71
72 protected void exportReport() throws Exception {
73 DynamicJasperHelper.generateJRXML(this.dr, this.getLayoutManager(), this.params, "UTF-8",System.getProperty("user.dir")+ "/target/" + this.getClass().getName() + ".jrxml");
74 }
75
76 public static void main(String[] args) throws Exception {
77 JrxmlExportTest test = new JrxmlExportTest();
78 test.testReport();
79
80
81 }
82
83 }