JasperReportBuilder report = DynamicReports.report();
1. The default font for the whole report.
report.setDefaultFont(stl.font("<font name>", isBold, isItalic, fontSize ));
//Or
// report.setDefaultFont(stl.fontArial().setFontSize(9));
// report.setDefaultFont(stl.font().boldItalic());
// report.setDefaultFont(stl.font().setUnderline(true));
2. Font for a column
report.columns(col.column("Name", type.stringType())
.setStyle(stl.style().setFont(stl.font("<font name>", isBold, isItalic, fontSize ))));
//Or
// TextColumnBuilder clmn = col.column("Name", type.stringType());
// clmn.setStyle(stl.style().setFontSize(9).bold().italic());
//report.addColumn(clmn);
4. Font for a text component
cmp.text("<your text>").setStyle(stl.style().setFont(stl.font("<font name>", isBold, isItalic, fontSize )));
5. Font for a sub-report
SubreportBuilder subreport = <your sub-report>;
subreport.setStyle(stl.style().setFont(stl.font("<font name>", isBold, isItalic, fontSize )));
---------------------------------------------------------------------------------------------------------
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.
This was, by far, the easiest way I found to alter fonts in DynamicReports. Thanks a ton!
ReplyDelete