Been busy writing reports lately, but I thought that I would try to publish a few quick tips that I have turned up.
One of the issues I have faced is that when a report is being formatted for PDF layout, I want it to be constrained to the page dimensions and to have it in portrait style. At the same time, when it is displayed for HTML, I want to have it in Landscape mode since the rendering seems to be better for HTML.
This little section of script placed in the beforeFactory method of the ReportItem will do that for you.
var renderO = reportContext.getRenderOption().getOutputFormat();
// change layout
if (renderO == "pdf"){
reportContext.getDesignHandle().getMasterPages().get(0).setProperty("orientation","portrait");
} else if (renderO == "html")
reportContext.getDesignHandle().getMasterPages().get(0).setProperty("orientation","landscape");
3 comments:
This cut off some of the columns of info in the pdf.
Could you make the same but only for a table data component? I mean, I want a report in portrait orientation but only one table in landscape. is it possible?
Thanks in advance.
yes. Just make two master pages. On the one table, click the page break property and set its master page to the one you made landscape.
Post a Comment