Hi guys,
I have created a report having 2 groups and detailed band - overall 3 sections (2 groups+1 detail band).
I have placed 3 different table components in each of the section(2 groups + 1 detail band).
General output of the report : 7 pages (1st 2 pages 1st group output + 3 to 6 pages outuput belongs to another group + and the last page output belongs to detail band).
What I want to do is : I have to display 1st group data in one sheets , 2nd group data in another sheet and the detail band data in one sheet. - in 3 different sheets of same excel file
I have tried below:
1st trail:
selected each of the table comoponent and in it's property set individually for all the table components
net.sf.jasperreports.export.xls.sheet.names.1 Name: 1stsheet
net.sf.jasperreports.export.xls.sheet.names.2 Name: 2ndsheet
net.sf.jasperreports.export.xls.sheet.names.3 Name: 3rdsheet
In the report properties set like this:
net.sf.jasperreports.export.xls.one.page.per.sheet
true
2nd Trail:
Along with the 1st trial added/removed - experimented
net.sf.jasperreports.export.xls.ignore.cell.border
false
net.sf.jasperreports.export.xls.remove.empty.space.between.rows
true
Also experemented with pagination , with out pagination in all the trails.
Also experimented with Tools->Options->Export->Excel properties -> One page per sheet.
Also experimented by giving page breaks after table components in each of the group.
Also did above point in group footers..
I should not go for sub reports -(It's my requirement not to work out with sub reports )
Can some one please help me in this ?
(Quick issue : 3 sections (2 groups+ 1detaliled tab) - 3 table components in each section -7 pages of output in the server- each section output has to go in 3 sheets individually in single excel file)
Many thanks in Advance.
Sadakar
BI developer
6 Answers:
To control pages in Excel exports I usually do the following.
1) Explicit page breaks in the report where a new sheet should be created
2) Set the property net.sf.jasperreports.page.break.no.pagination=apply on the report to tell the engine to apply the page breaks. Might also have to set net.sf.jasperreports.export.xls.one.page.per.sheet=true
3) Export the report with the non-paginated exporter
4) Use the property net.sf.jasperreports.export.xls.sheet.name=<sheet-name> on the first element after each page-break to set the name of the sheet. Can be an expression setting the name based on data.
Thank you very much...
It has worked well...
:)
but running with another issue when I use this..
Actually I have startdate and enddate parameters in my report.. when I give wrong input controls ( for instance : startdate:7th Sep 2013 enddate 26th Sep 2013) also it is giving 3 pages of output.. i.e., it is printing page breaks when there is no data..
What I would like to see in report is :
When I select wrong input controls it has to show the report is empty
(But it is not happening now as I'm using page breaks)
Try a "print when" expression on the page break to only print it when there is data in the section. For example by checking the first value of a field.