Friday, May 30, 2014

DynamicReports: Setting page/paper orientation and margins

JasperReportBuilder report = DynamicReports.report();

//Setting the page/paper type and paper orientation for display (report.show())
report.setPageFormat(PageType.LETTER, PageOrientation.LANDSCAPE);
// report.setPageFormat(PageType.A4, PageOrientation.PORTRAIT);

//setting the orientation for saving to a file (report.toPdf(), report.toText(),...)
report.setPrintOrder(Orientation.VERTICAL); //landscape
//report.setPrintOrder(Orientation.HORIZONTAL); //portrait

//setting the page margins
report.setPageMargin(DynamicReports.margin().setLeft(50).setTop(80).setRight(50).setBottom(80));

StyleBuilder titleStyle = Styles.style().bold().setHorizontalAlignment(HorizontalAlignment.CENTER);
report.title(Components.text("Test Report")
                .setStyle(titleStyle));

report.columns(Columns.column("column 1", "col1", DataTypes.stringType());

report.setDataSource(<your data source>);

report.show(false);
       
-----------------------------------------------------------------------------------------------------------------

                        
If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book free here.

No comments:

Post a Comment