Friday, May 21, 2010

Reporting Services: Textbox changes position when the report is previewed

Have you ever faced a situation where a textbox (or image) changes the fixed position when the report is previewed?  One of my colleagues faced it yesterday. I had no answer for him but fixed the issue. Here is the issue:

Assume that you have designed a report like below. The region has been set as a tablix, the CalenderYear column grows based on number of years available in the dataset. Three textboxes have been placed on top of the data region.

textimage1Here is the preview of the report. The position of third textbox has been changed, aligning with the edge of tablix data region.

textimage2What I understood was, if the Location-Left property of textbox is greater than Location-Left + Size-Width of tablix data region, Location-Left property of textbox is set to Location-Left + Size-Width(Actual) when the report is previewed. But, this is not going to happen if the Location-Left property of textbox is less than Location-Left + Size-Width of tablix data region.



I tested this with a table data region and noticed that it has no such an issue, obviously, reason is, no grouping on columns in it.

There is a workaround for this. All you have to do is, place all textboxes in a rectangle. Once you have all textboxes in a rectangle, positions of textboxes are not going to be changed.


I googled for finding a reason for this but could not find. Although there is a workaround, I would like to know the reason for this, or what I have missed, and the proper way to fix it. Can you help me on it?


Tiago said...

Thank you!!! You saved me a lot of time!!! :)

Salih Boutadghart said...

Thanks man ! You saved my time :D

Dinesh Priyankara said...

Salih, you are welcome, what is the version used? Just want to whether you experience the same with latest SQL Server version.