Tuesday, March 11, 2014

DynamicReports in java (4) - Setting/formatting the title

       JasperReportBuilder report = DynamicReports.report();

1. Setting a simple title for the report

      report.title(Components.text("The Comprehensive Report")
              .setHorizontalAlignment(HorizontalAlignment.CENTER));

2. Using styles

       StyleBuilder titleStyle = Styles.style().bold()
              .setHorizontalAlignment(HorizontalAlignment.CENTER)
              .setFontSize(14)
              .setBackgroundColor(Color.LIGHT_GRAY)
              .setBorder(Styles.pen1Point());

        report.setTitleStyle(titleStyle);

3. Setting a multiple line title

       report.title(Components.text("Statistic Report")); //first line
       report.title(Components.text("Longevity in Populations));//second line
       

4. Setting a title with multi-components on one line

       SimpleDateFormat formater = new SimpleDateFormat("MM/dd/YY");

      report.title(Components.horizontalList(Components.text("Date: "+ formater.format(new Date()),
                Components.filler().setFixedWidth(420),
                Components.text("First Part"))
              .setStyle(Styles.style(bold).setHorizontalAlignment(HorizontalAlignment.LEFT)));

5. Print Title on top of each page

      Use report.pageHeader(ComponentBuilder... component) instead of report.title(ComponentBuilder... component)

            Previous<      >Next

-------------------------------------------------------------------------------------------------------------
          
                        
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.

References:

4 comments:

  1. tnx a lot!, it's another joyful day finding the solution here in the world of joy...best regards...more power!

    ReplyDelete
    Replies
    1. Glad that you are having a joyful day! And you are always welcome to the world of joy :)

      Thanks for the comment.

      Delete
  2. Really helped! Thanks very much!!
    Partha

    ReplyDelete