chetan
chetan

Reputation: 3255

Cannot set landscape orientation in dynamic jasper report

DynamicReport firstDynaRep = new DynamicReport();
firstDynaRep.setTemplateFileName("./landscape.jrxml");
firstDynaRep = firstReport.build();

DynamicReport not taking it as a template. So the width of the page is not increased. So is there any way to increase the width of the page in dynamicjasper report? (I want the report in landscape orientation.)

Upvotes: 3

Views: 4317

Answers (3)

satish
satish

Reputation: 41

Page page = new Page(); page.setOrientationPortrait(false);

This will bring up the page in landscape mode

Upvotes: 0

Braully Rocha
Braully Rocha

Reputation: 1402

Modify page size and orientation.

DynamicReportBuilder drb = new DynamicReportBuilder();
drb.setPageSizeAndOrientation(Page.Page_A4_Landscape());

OR

int w = ???
int h = ???
boolean portrait = false;
drb.setPageSizeAndOrientation(new Page(h, w, portrait);

Upvotes: 2

Giorgos Dimtsas
Giorgos Dimtsas

Reputation: 12609

I haven't used DynamicJasper for a long time, but I believe you should be using setTemplateFileName() on a DynamicReportBuilder and not on DynamicReport

DynamicReportBuilder drb = new DynamicReportBuilder();
drb.setTemplateFile("./landscape.jrxml");
DynamicReport firstDynaRep = drb.build();

Upvotes: 0

Related Questions