Some of our reports aren’t displaying properly in Firefox – the first column lacks any css. After investigating, I’m finding:
<tr>
<td style="HEIGHT:6.93mm" style="...">1st Column</td>
<td style="...">2nd Column</td>
<td style="...">3rd Column</td>
</tr>
When I remove the style=”HEIGHT:6.93mm”, it renders properly in Firefox.
Per JudyX’s post here on Monday, February 13, 2006 11:54 PM:
The first column in reports cannot be styled correctly. The report viewer control requires a “height” be specified for all table rows. Unfortunately, it applies this not to the table-row element, but to the first table-cell within that row. When it applies that as a style attribute, it conflicts with the style that we set elsewhere.
Has anyone found a solution to this?
I can confirm that this still happens with SSRS 2005. Firefox is not the only browser that will not render this as intended by the report designer. Apparently IE7 (and probably IE6) assume the last style attribute to “win” if there are multiple style attributes assigned on an element. IE8 in standards mode and Firefox assume the first style attribute to “win” in this situation. I would assume that all standards compliant browsers will make the same choice as IE8 and Firefox, although our team has not tested this.
I haven’t found a solution in terms of a hotfix, but I do have a way to prevent the bad HTML from making it to the browser. OMG Ponies – thanks for posting that link to JudyX’s post. Wodeh responded with a good solution about 3/4 of the way down that post – unfortunately, it was not entirely clear how to use the code that was posted.
The approach is to use a response filter on the page that contains the ReportViewer Control. The filter has access to the raw HTML that will be sent to the browser, and that provides the opportunity to modify the HTML directly without having to result to the new first column trick. In our Page_Load method, we set the Response.Filter property with the following code:
The CorrectSSRSIssuesResponseFilter class is defined as follows, and is mostly based off of Wodeh’s code from the post. The secret sauce is in the Write() method which uses the RegEx to wipe out the first style attribute: