Sunday, December 16, 2012

Display more than 2000 characters in SSRS report

We would like to share one of our experiences with SSRS reports. One of the reports we were building required displaying of notes that could hold more than 2000 characters.
 Including a text box worked fine for most of the records but we observed that the ones that had more than 2000 characters reported error. To show the entire content of the notes in SSRS reports you can try the following workaround:
Add a textbox with the following expression

 =IIF(Len(Fields!description.Value) >= 2000,Left(Fields!description.Value,2000) ,Left(Fields!description.Value,2000))
This will show the first 2000 characters.
For the next 2000 add a blank row and include a textbox with the following expression
=IIF(Len(Fields!description.Value) >= 2000, cstr(Fields!description.Value).Substring(2000), "")
If the content included is less than 2000 characters in the first place itself, then to hide the blank row add the following expression to the visible property
=IIF(Len(ReportItems!txtDescription.Value) >= 2000,false,true)
Note ReportItems!txtDescription refers to the same textbox that we are hiding
This way we were able to increase the display limit to 4000 characters to increase it further add another text by using the same logic as above.

Hope this helps!



  1. I was facing the same issue and I followed your solution but it did not work for me. Did this solution work for you? I am still getting an error. How can you assume that Email Body can have maximum of 4000 characters? Email body can have even 10000 Characters.

  2. Yes, email body take more than 4000 characters and for that you have to add multiple new rows that will show characters after 4000 and so on.

    You are still getting errors because it may have happened that your HTML tag is breaking i.e. in first 2000 characters there will be start tag and in next 2000 character there may be the rest half tag. So you can first check whether the HTML tag is breaking or the HTML which you are getting is more than 4000 characters, the count is on the basis of characters of HTML tags and not the plain text.

    Hope this helps!