Interactive sorting in SSRS reports is a useful and common tool to employ when creating tabular reports. However it automatically applies some formatting which can interfere with existing formatting, and make it difficult to know the actual sizes you’re dealing with.
Below is an example of the grid I wish to apply Interactive Sorting to:
However, when I apply the default interactive sorting, it alters the layout of my headings:
We can see that the “Phone” heading has been forced to a new line, and our nicely centred headings are no longer centred. If you’re working under tight space requirements for the report, simply extending the “Phone” heading may not be a valid option, and off-centred headings can make your report look tacky.
There are however a few tricks you can use to get around both of these issues, and keep consistency in the formatting of your report. My personal preference is creating separate columns, which have the same width, either side of the column you wish to add interactive sorting to. Instead of applying interactive sorting to the main column, you can now apply it to the column on the right (or left if you so desire). You can then merge the data row columns into a single cell, and you’re done! You have now kept your column heading centred, and can clearly see the amount of space you’re actually dealing with.
You’ll note that due to the limited space for the “Phone” heading, I have only used one additional column.
While the columns you add can be of whatever size you wish, it seems that 0.185in is the magic number to be as small as possible without shrinking the default size of the interactive sorting icon.
In order to keep my data column the same size, I have subtracted the size of the additional columns from my main heading column.
As you can see, this method actually results in more space for your headings, with “Phone” now fitting alongside interactive sorting even though it is still the same total width.
Having interactive sorting in a separate column means we have the freedom the play about with its positioning, without effecting the heading itself. For example, we can modify the padding to make the interactive sorting icon centred in the cell.
This concept could have a multitude of applications, so be creative! A small amount of lateral thinking can go a long way!
One point to note about this method is that it will interfere with excel formatting, so if you’re designing a report to be exported to excel, use with caution!