Friday, February 19, 2010

How to Eliminate Merged Cells from a Reporting Services Excel Export

Recently i developed a report as i do normally by using Page Header (Images and Report Heading), Body (Data within tables) and Page footer (Page Numbers and date and time of report generation). When displaying on the web page or export to excel, all fields and layout shows correctly with out any issue. But the problem is when export to excel, some of the columns were merged as shown below.

image
Most of the time Merged cells wont be a problem until and unless you want to use Excel sort functionality (in current project, it is crucial to sort columns).Excel requires that ranges of merged cells be identically sized in order to be sorted.
So the million dollar question is, Why does the SRSS Excel render merge cells? It’s important to keep in mind that the excel render is primarily a layout render. As i told earlier, i used Page Header to hold the G2G logo and Report header. To preserve the layout, Excel render merged the cells on the worksheet surface like as show on the above screenshot.
If exporting to excel with the ability to sort is important to you, here are some tips to help you reduce the amount of merged cells in excel workbooks.
  1. Make sure the left and right edges of all report items line up with one another. This is the #1 cause of merged cells. so here what i did is, i created a new header row in report Body table and copy the image in one column and report header in to another column and then remove the Page header (see the screen shot below) image
  2. Even though you line up everything precisely as mentioned in step 1, in some rare conditions, you still see some columns merged. This could be due to internal rounding  and unit conversion issue. Since excel format wants everything in points, you should avoid using pixels,inches,centimeters and consider specifying all your measurements in points for the most direct results.


Before you leave:

  • Tell me whether you like this article or not? Rate this post accordingly by selecting the stars below.
  •  Any suggestion, question or comment? Please post it in the comments below.

0 comments:

Post a Comment