Exporting Report to Excel - Multiple pages

0

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

 

sadakar's picture
627
Joined: Aug 14 2012 - 3:57am
Last seen: 1 week 6 days ago

6 Answers:

0

just try a page break between ..may be it will help

hishamkmr's picture
Joined: Sep 4 2013 - 5:07am
Last seen: 5 years 6 months ago
1

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.

nicolaifriis's picture
Joined: May 25 2010 - 4:32am
Last seen: 4 years 2 months ago
0

Hi, thank you for repling.

How to display 3 to 4 pages of output of a group in signle page and anthor 4 to 5 pages of output of another band in another signle page ?

Can you please provide some inputs ? Very urgent need.

Sadakar

 

sadakar's picture
627
Joined: Aug 14 2012 - 3:57am
Last seen: 1 week 6 days ago
0

Here is the problem statement in picture format.. please find the image and guide me.

Thanks,

Sadakar

sadakar's picture
627
Joined: Aug 14 2012 - 3:57am
Last seen: 1 week 6 days ago
2

If you set the property net.sf.jasperreports.page.break.no.pagination=apply and add a page break first in each band header you should get a new sheet for each page-break. You have to use non-paginated Excel export when running it.

nicolaifriis's picture
Joined: May 25 2010 - 4:32am
Last seen: 4 years 2 months ago
0

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)

sadakar's picture
627
Joined: Aug 14 2012 - 3:57am
Last seen: 1 week 6 days ago

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.

nicolaifriis - 6 years 1 month ago
Feedback