2
votes

When exporting a multi-page report from SQL Server 2008 Reporting Services to Excel, by default, pages in the report created by a page break are sent to separate worksheets in the Excel file.

While this is fine most of the time - sometimes it's not. Right now, I'd like to be able to prevent those page breaks from causing additional worksheets to be created - I really would like to export all my pages into a single Excel worksheet and basically just ignore the page breaks (or replace them with -------- or something like that).

So when exporting my list of locations for a customer to PDF, I would like to put each location on a separate page (the location details are rendered out as a subreport, inside a grouping on the main report). But if I export to Excel, I'd like to keep all data together in one worksheet.

I did find that the grouping on the main report contains a "Page Breaks: Between" setting - but I can't seem to find a way to dynamically (e.g. by means of a parameter) change that so that I could turn it on for PDF rendering, and OFF for Excel exports.

How can I do that - if at all? Any ideas? I can't seem to find any properties to set or hooks to hook into to influence the Export export from SSRS...

1
Unfortunately, I don't know if this is possible in plain 2008, not with the natives tools available, anyway. MS addressed this in 2008 R2 where you have report variable to determine the renderer being used and the ability to enable/disable page breaks with expressions, but for 2008 this is not available.Ian Preston
@IanPreston: sucks - but thanks for your reply !marc_s

1 Answers

3
votes

You can condition page breaks with a small rectangle that has a page break at the end, which you then hide when you don't want a page break. If you condition the Hidden attribute as =Globals!RenderFormat.Name = "EXCEL", the rectangle will be hidden in Excel exports and the page break won't happen.

Visual Studio DesignerVisual Studio PreviewExcel Export