Exporting to Excel when you have a subreport.

Sunday 22 April 2012 @ 10:33 pm

Exporting Crystal Reports to Excel can be tricky. I have written several articles on techniques to make it easier. But it gets even trickier when a subreport is involved.

Without a subreport I have found that you can get a clean export by using the “Data Only” option. But this doesn’t work with a subreport. I tried two different methods with the “Data Only” export that would not work.

1) Line up the subreport and leave it visible. This adds extra rows to the export and moves the subreport values down one row.

2) Use a ‘stealth’ subreport which runs invisibly in the background, pass the values to formulas in the main report using shared variables. This also adds extra rows to the export.

The only method I found that worked was to use the regular Excel Export instead of “Data Only”.  But you have to line up the subreport  (as well as the objects within the subreport) so that they are in line with the main report objects.  Line them up carefully and they will export to excel with subreport objects aligned correctly.

Leave a Reply

Recrystallize Pro