SQL Reporting Services - CSS fix for Firefox

SSRS 2005 is pretty slick, but the HTML is just terrible. Reports are displayed in an IFRAME that's deep in nested table land, and the IFRAME's height setting only works in IE. The end result is that reports don't display correctly in Firefox - the IFRAME's height defaults to a few hundred pixels, so you only see the top 2 inches of the report. However, they did the right thing by designating CSS classes for most of the important elements, so we can fix it by adding a min-height setting. I'm sure there are other issues with getting SSRS to display correctly in Firefox, and possibly other answers (let me hear them in the comments below), but this CSS fix at least lets the reports show.

Add the following to the ReportingServices.css file (by default, it's found in "C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportManager\Styles\"):

 /* Fix report IFRAME height for Firefox */

.DocMapAndReportFrame
{
min-height
: 860px;
}

If you're really lazy, you can just run this batch script which will make the change for you:
::Add to C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportManager\Styles\ReportingServices.css
SET CSSFILE=%ProgramFiles%\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportManager\Styles\ReportingServices.css
IF NOT EXIST "%CSSFILE%.bak" COPY "%CSSFILE%" "%CSSFILE%.bak"
echo. >> "%CSSFILE%"
echo. >> "%CSSFILE%"
echo /* Fix report IFRAME height for Firefox */ >> "%CSSFILE%"
echo .DocMapAndReportFrame >> "%CSSFILE%"
echo { >> "%CSSFILE%"
echo min-height: 860px; >> "%CSSFILE%"
echo } >> "%CSSFILE%"

Notes / Disclaimers / Retractions

This just adds a min-height attribute to the class used for the IFRAME. Of course, you can set the min-height to another value if you'd like; if you make it larger than your end user's screen height they'll see a scroll bar and may go into convulsions.

This change isn't needed for IE7. One of the big changes to IE7's CSS handling is that it will stop treating height and width as min-height and min-width, but IE7 and Firefox still treat height=100% differently (at leat for IFRAMES).

Please let me know if there's a better way to fix this, more to be fixed, etc. Please also let Phil know what you'd do if you won the lottery.

Update

This only fixes height for charts. Another common problem is width - for instance, tablular reports end up smashed horizontally. I haven't found a CSS fix for this; the best option I've found so far is to add an empty textbox that stretches the width of the report. 

Published Friday, September 01, 2006 10:58 PM by Jon Galloway
Filed under: ,

Comments

# re: SQL Reporting Services - CSS fix for Firefox

I have a similar problem - but with the width instead of the height.  I tried your fix - adding  min-width - but it did not impact the output at all.  This does not happen with a graph - which makes me think that a report rendered as an image would not have the problem either - but I would rather stay with HTML.  Any ideas on what would fix this problem?  Thanks.

Thursday, September 07, 2006 4:43 PM by David

# re: SQL Reporting Services - CSS fix for Firefox

Not having any luck with setting min-width, I found another way to make my report be the correct width for Firefox and Safari.  My before-fix display was only about 1.5 in wide in Firefox and completely invisible in Safari.  The report is 8.5 wide with 1 in margins.

My fix:

I dropped in the old transparent GIF in the header along with my heading.  Then I sized the GIF to 6.5 in - the width of my report minus 1 in margins.  Then - I get a properly displayed report in Firefox and Safari.

I don't really like the fix - hopefully MS will fix this in the future.

Friday, September 08, 2006 2:35 PM by David Baker

# re: SQL Reporting Services - CSS fix for Firefox

I haven't found a way to fix width via CSS yet. What a mess of nested tables and iframes - yuck!

I ended up adding a textbox to the top, underneath the title, and sized to the correct width. It seems a bit less ugly to me than the spacer gif, but it's still horrible.

Saturday, September 30, 2006 4:23 AM by Jon Galloway

# re: SQL Reporting Services - CSS fix for Firefox

Thanks for that tip! Works great.  

Thursday, October 12, 2006 8:50 PM by Scott Love

# re: SQL Reporting Services - CSS fix for Firefox

Regarding the problem with table data, displaying the report as a subreport seems to correct the formatting problem.  Thanks for figuring out the ".DocMapAndReportFrame" trick!

Wednesday, November 08, 2006 11:59 PM by Anonymous

# re: SQL Reporting Services - CSS fix for Firefox

I tried the image trick but Firefox still displays the table about 1 inch wide. Which it is supposed to be 8.5 inches.

What could I be doing wrong? Where did you guys put the image in the css file or the table itself?

Friday, December 08, 2006 6:36 PM by DJ

# re: SQL Reporting Services - CSS fix for Firefox

@DJ - It needs to be added to the report, not the CSS. I use a textbox instead of a transparent GIF, but either should work.

Friday, December 08, 2006 7:25 PM by Jon Galloway

# re: SQL Reporting Services - CSS fix for Firefox

Not only CSS is not working... there are more to go for the Reports administration interface. Yuck, when will M$ finally test their stuff with 'major popular browsers'? I personally really hate IE due to the long going security leaks and poor performance comparing to firefox.

Friday, December 15, 2006 6:07 AM by goodwill

# re: SQL Reporting Services - CSS fix for Firefox

the textbox or image solution works only for the first page. Any idea of making it work for the rest of pages?

Tuesday, January 16, 2007 4:08 PM by Juan

# re: SQL Reporting Services - CSS fix for Firefox

I found that if you place the Table inside of a rectangle it maintains the width throughout all the pages.

Wednesday, January 24, 2007 1:43 PM by Sarah

# re: SQL Reporting Services - CSS fix for Firefox

I have developed a web app accesing the Report Server using SOAP over http. I have the same problem mentioned above Firefox cannot parse the html correctly. I cannot see how changing any .CSS will help me if i am not using the report viewer, can anyone help me out with this.

Monday, February 05, 2007 12:41 PM by Ivan

# re: SQL Reporting Services - CSS fix for Firefox

I have developed a web application  accessing the SQL Reporting  Services2005  over http. I have the same problem mentioned above Firefox, that Report can be viewed using IE and not using Firefox.

Can anyone can help me out of this!!!!!

Thursday, May 10, 2007 9:45 AM by Ajith

# re: SQL Reporting Services - CSS fix for Firefox

few columns are merging while we deploy our reports in firefox, but it is viewable correctly in IE.

If any one faced these kind of issue, please paste ur comment.....

Monday, May 14, 2007 10:18 AM by Sri Harsha Kasi

# re: SQL Reporting Services - CSS fix for Firefox

hi, faced the same width probelms and it took me a while to figure out it was a browser issue cause i didnt doubt my firefox even one bit.

I found if you stretch the page header title textbox to the width of the page it should sort you out.

You could always have a blank one if you dont need a page header.

Either way the header helps maintain the page width you require.

Cheers,

ajnar

Monday, May 21, 2007 10:03 AM by ajnar

# re: SQL Reporting Services - CSS fix for Firefox

When I put a blank text box and stretch it over the width of the report, I get the report correctly but this is applicable only for the first and the last page. All the intermittent pages have the columns squeezed. I have put in the 860pixels as suggested by some of you... but still didnt work. Can anyone help !

Thursday, May 31, 2007 1:52 AM by Kasi

# re: SQL Reporting Services - CSS fix for Firefox

The suggestions of textbox is good for fixed width reports.  But what about matrix tables?  Since I don't know the actual width of the final report, how can I stretch a blank textbox to that width?

Thanks,

Brian

PS:  Does anyone know when Microsoft is gonna put out a fix for all of these Firefox display issues?

Monday, June 04, 2007 11:10 AM by Brian

# re: SQL Reporting Services - CSS fix for Firefox

I'm currently having the same problem.  We have a client that strictly uses Firefox and I can't find a fix for a matrix table.  If anyone has any suggestions please share.

Monday, June 04, 2007 7:59 PM by Mark

# re: SQL Reporting Services - CSS fix for Firefox

I was able to implement a hack to fix the Firefox display issue when using a matrix report.  Like another hack above, I use a textbox for my hack.  

I found that when the 'CanGrow' element is set to true, the width of the textbox grows with the length of a string stretching the width the report.  Although, for IE this element will expand the textbox vertically so you should place the textbox under the report to avoid any re-formatting.

"But you still don't know the size of the report?"  Well, I dynamically build a string using the expression option for the 'value' element of the textbox.  I use the 'StrDup' method to duplicate the string.  You use a multiplier along with the count of the elements to group to duplicate the string to the reports width.  

Example: StrDup(20*CInt(parameters!param_name.count),"_")

"That's great, but now you have a long string at the bottom of your report."  This is easy.  Just set the font color to the background color of the report and voila it disappears.

Well, this is the hack.  It's not great, but it works.  I hope it'll help out others until Microsoft decides to fix this issue.  

-Good Luck

Wednesday, June 06, 2007 5:29 PM by Mark

# re: SQL Reporting Services - CSS fix for Firefox

Finally, hours and hours searching the net, i found a "fix" for the "height" attribute of the Iframe...

In FF, Iframe's height=100% is not allowed, so adding style=min-height:xxx (in pixels) before height=100% shows a height of xxx iframe in FF. Instead, IE and Opera shows a height of 100%.

Is not a really fix, is a patch... While awaiting for an update about this issue for FF, is just a beginning...

I Hope FF3 will support it!

Wednesday, June 27, 2007 1:04 AM by McFly_24

# re: SQL Reporting Services - CSS fix for Firefox

Still having problems. I tried a blank textbox at the top of the body and again in the page header that stretches the width of the page which happens to only be 3 inches in this case. FF still only displays half or about 1.5 inches. Any suggestions?

Saturday, July 14, 2007 11:02 AM by Andy

# re: SQL Reporting Services - CSS fix for Firefox

If you put the stretched-out text box in your report header or footer, it will fix the width for the whole report -- not just the first page.  I created a report footer and set both, it's height and the textbox height, to 0.001in so it's not very noticeable.  Problem solved!

Wednesday, July 18, 2007 11:13 AM by Matt

# re: SQL Reporting Services - CSS fix for Firefox

...also, be sure you're using the latest ReportViewer redistributable on your server: support.microsoft.com/.../933137

I'm using the redistributable SP1 and I don't have any problems with height -- just width.

Wednesday, July 18, 2007 11:17 AM by Matt

# re: SQL Reporting Services - CSS fix for Firefox

As mentioned before if you place the textbox in report footer it will fix all the pages thanks for the help guys :).

Friday, July 27, 2007 4:52 PM by John

# re: SQL Reporting Services - CSS fix for Firefox

Table Reports: Keep the CanGrow Property to "True" and if still the problem persists go to that particular cell which is merging and drag a rectangle over that and drag a text box with CanGrow Property set to "False" (Default).

Matrix Reports:

in each of the cells (Row cell / Column cell),Drag a rectangle and place a textbox over it with CanGrow Property set to "False" (Default).

I think the Column cells will merge few times, in that case set the CanGrow to "false".

That's it ...

The reason for dragging rectangle is, it helps in formatting or in other words wrapping of text happens, which generally doesn't happen in firefox.

Friday, August 03, 2007 5:16 AM by Sri Harsha Kasi

# re: SQL Reporting Services - CSS fix for Firefox

Problem:

          In Matrix reports the "sub Total" Columnm is getting wrapped to .0001 in (Probably! not to that accuracy), But i can see the remaining part like Row and Column Cells r displaying properly.

only the Last Column is being truncated..

This happens only in FireFox But not in IE.

Required Result:

               "Sub Total" column also has to be seen clearly as other cells.

Any Suggestions???????

Friday, August 03, 2007 5:27 AM by Sri Harsha Kasi

# re: SQL Reporting Services - CSS fix for Firefox

I drew a large rectangle behind the report, and it fixed the width problem for all pages of the report. No effect on the height problem tho.

Monday, August 13, 2007 4:19 AM by Sinnee

# re: SQL Reporting Services - CSS fix for Firefox

If I set AsyncRendering=False for ReportViewer, is that going to help in any way?

Tuesday, October 09, 2007 5:58 AM by Jack

# re: SQL Reporting Services - CSS fix for Firefox

the maximum allowable page height in reporting services is 4064mm. I set that as my page height and the width problem that occurs in firefox when it goes to a new page occurs now in only the most stupidly large reports

Friday, October 19, 2007 12:16 AM by me

# re: SQL Reporting Services - CSS fix for Firefox

hmm.....totally time wastage...

Thursday, October 25, 2007 7:10 AM by vikash

# re: SQL Reporting Services - CSS fix for Firefox

for tabular reports placing the table in a rectangle helps in showing the reports normally as in ie6 or 7, but the alternate row colors for the first column in the report is not visible...all the other columns have alternate row colors displayed properly...any fix for this??

Wednesday, October 31, 2007 2:39 AM by ramesh_forums

# re: SQL Reporting Services - CSS fix for Firefox

Here's a javascript fix I came up with to change the iFrame's height from 100% to a set value. Sinc e the main issue is that Firefox doesn't support iFrame's with 100% height, it just needs to be set to a fixed number within the main reportViewer's DIV.

Example:

           <rsweb:ReportViewer ID="rptViewer" runat="server" ProcessingMode="Remote" CssClass="reportViewer" Height="450px" Width="100%"></rsweb:ReportViewer>

           <script language="javascript" type="text/javascript">

               //FireFox fix - iFrames don't support height's of 100% in firefox.

               var iFrameViewer = document.getElementById('ReportFramectl00_ContentPlaceHolder1_resultsReport_rptViewer');

               iFrameViewer.style.height = "419px";

           </script>

Tuesday, November 13, 2007 6:40 PM by gelletto1138

# re: SQL Reporting Services - CSS fix for Firefox

I tried to use your script but with spreadsheet files and other Google docs that I used at FF, I’m still having the same problem.  

Monday, December 03, 2007 11:52 PM by portraiture

# re: SQL Reporting Services - CSS fix for Firefox

thanx for that fix.

Thursday, January 31, 2008 10:47 AM by Faberis

# re: SQL Reporting Services - CSS fix for Firefox

We have been having the issue for some time as well. Since the Mozilla Firefox 2.0.0.12 release, the issue seems to no longer occur.

Monday, February 11, 2008 10:41 AM by Jason

# re: SQL Reporting Services - CSS fix for Firefox

Width issue still present for me in Firefox 2.0.0.12. Never had height issue.

Monday, February 11, 2008 7:42 PM by Jeff

# re: SQL Reporting Services - CSS fix for Firefox

Remove the overflow-x:hidden from the HTML or CSS then a report renders OK in Firefox 2.0.12

Even better, the report renders over 10x FASTER!

This may be related to CanGrow setting mentioned above - I haven't checked.

Example CSS/HTML is:

.r11{WIDTH:100%;overflow-x:hidden}

which applies to all cells:

<TD class="a130"><DIV class="r11">6.00</DIV></TD>

However there is still the problem that cell sizes are not fixed, but expand to fit content.

Tuesday, February 12, 2008 10:52 PM by Morris

# re: SQL Reporting Services - CSS fix for Firefox

Looking at the generated HTML the other problem is that the column widths are not fixed. Fixing the widths makes the report print correctly on Firefox, Opera and Safari.

Setting the table-layout:fixed and giving the table a width that is the sum of the first row e.g. adding

.a5 {

 table-layout: fixed;

 width: 539.71mm;

}

to the CSS file for:

<TABLE CELLSPACING="0" CELLPADDING="0" LANG="en-AU" class="a5" COLS="19"><TR><TD HEIGHT="0" style="WIDTH:10.00mm"></TD><TD HEIGHT="0" style="WIDTH:10.00mm"></TD><TD HEIGHT="0" style="WIDTH:54.55mm"></TD><TD HEIGHT="0" style="WIDTH:34.55mm"></TD><TD HEIGHT="0" style="WIDTH:35.46mm"></TD><TD HEIGHT="0" style="WIDTH:27.88mm"></TD><TD HEIGHT="0" style="WIDTH:32.12mm"></TD><TD HEIGHT="0" style="WIDTH:29.09mm"></TD><TD HEIGHT="0" style="WIDTH:24.85mm"></TD><TD HEIGHT="0" style="WIDTH:36.06mm"></TD><TD HEIGHT="0" style="WIDTH:26.36mm"></TD><TD HEIGHT="0" style="WIDTH:20.30mm"></TD><TD HEIGHT="0" style="WIDTH:30.30mm"></TD><TD HEIGHT="0" style="WIDTH:31.21mm"></TD><TD HEIGHT="0" style="WIDTH:23.64mm"></TD><TD HEIGHT="0" style="WIDTH:27.88mm"></TD><TD HEIGHT="0" style="WIDTH:24.85mm"></TD><TD HEIGHT="0" style="WIDTH:27.88mm"></TD><TD HEIGHT="0" style="WIDTH:32.73mm"></TD></TR>

For Firefox, the overflow-x:hidden; needs replacing with just overflow:hidden; to fix the speed issue (but still cropping oversize content in cells as desired!).

If anyone knows of a good way to calculate the proper width in mm easily that would be great!

Tuesday, February 12, 2008 11:10 PM by Morris

# re: SQL Reporting Services - CSS fix for Firefox

Great solution for now, though hopefully it'll be solved in next version.

Monday, March 03, 2008 8:18 AM by Leila Goharian

# re: SQL Reporting Services - CSS fix for Firefox

I can tell you *why* the tables look wrong in compliant browsers, but unfortunately I can't figure out a good way to fix it.  The emitted HTML is just broken.  The HTML table that ultimately contains the report looks like this:

<table cellspacing="0" cellpadding="0">

<tbody>

<tr>

<td id="oReportCell" onpropertychange="ShowFixedHeaders()">

</td>

<td width="0" height="100%"/>

</tr>

<tr>

<td width="0" height="100%"/>

</tr>

</tbody>

</table>

There's several things very, very wrong with this HTML output.  First, the table has a mismatched number of columns per row, which is just sloppy.  Second, the second table row has no content, so it shouldn't even be there.  (Yes, I know it's probably there in case there is content but again -- sloppy.)  But the key is that second cell in the same row as the report.  It has a width of 100%, so it's expanding to take up as much of it's container as possible, leaving the actual content squished down as far as it can go.  If you pull up Firebug and delete that cell from the HTML, the report goes back to normal.

Unfortunately, I'm assuming there's no easy way to convince SSRS to stop emitted the extra elements.

Wednesday, April 02, 2008 1:07 PM by Mike Edenfield

# re: SQL Reporting Services - CSS fix for Firefox

But how do you set the CSS when using the client ReportViewer controls when using LocalReport? What CSS file is pulled then?

Sunday, April 13, 2008 11:14 PM by Mufasa

# re: SQL Reporting Services - CSS fix for Firefox

I am using Firefox 2.0.0.14 and had the same problem.

I used rectagle to enclose table and it wored; for width.

I had to add .DocMapAndReportFrame element to ReportingServices file for height.

Seems ok for me but not convienced yet.

And thanks for the tip.

Tyampoo

Tuesday, May 20, 2008 4:33 PM by Tyampoo

# re: SQL Reporting Services - CSS fix for Firefox

I have used rectangle for fixing the width problem. I am just putting the my report table and set the rectange width as same as my report width. It is working fine in both IE & Firefox.

Thursday, June 12, 2008 1:48 AM by Mohan Prajapati

# re: SQL Reporting Services - CSS fix for Firefox

I have added the following settings in the

"C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportManager\Styles\ReportingServices.css" folder

.DocMapAndReportFrame

{    

       min-height: 660px;

min-width: 1280px;

}

Now the Reports are opening fine.

Friday, June 20, 2008 2:13 AM by M.Mahendra

Leave a Comment

(required) 
(required) 
(optional)
(required)