none
ReportViewer in Firefox version 1.5.0.1

    Question

  • I have problem rendering the ReportViewer in Firefox version 1.5.0.1.  The width of the ReportViewer is much smaller than expected and the data is just messed up.  But the ReportViewer works fine in the early version such as 1.0.7.  Any clue on that?  Thanks.
    Thursday, February 09, 2006 9:20 PM

All replies

  • I am not aware of any rendering issues unique to the version of Firefox.  Will you send a simplified RDL that shows the problem?  We will investigate it.
    Friday, February 10, 2006 3:00 AM
  • Hi Brain,

    Below is the simplied RDL.  Thanks for your help.
     
    <?xml version="1.0" encoding="utf-8"?>

    <Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">

    <DataSources>

    <DataSource Name="DefaultDataSource">

    <ConnectionProperties>

    <ConnectString />

    <DataProvider>SQL</DataProvider>

    </ConnectionProperties>

    <rd:DataSourceID>598f9e62-e2c0-49eb-9858-f672339a5f4a</rd:DataSourceID>

    </DataSource>

    </DataSources>

    <Body>

    <ReportItems>

    <Table Name="table1">

    <TableGroups>

    <TableGroup>

    <Grouping Name="table1_Group1">

    <PageBreakAtEnd>true</PageBreakAtEnd>

    <GroupExpressions>

    <!-- This arcane expression causes the report to paginate after 25 rows -->

    <GroupExpression>=(RowNumber(Nothing) - 1) \ 25</GroupExpression>

    </GroupExpressions>

    </Grouping>

    </TableGroup>

    </TableGroups>

    <Header>

    <RepeatOnNewPage>true</RepeatOnNewPage>

    <TableRows>

    <TableRow>

    <TableCells>

    <TableCell>

    <ReportItems>

    <Textbox Name="header_ColName1">

    <Style>

    <PaddingLeft>4pt</PaddingLeft>

    <PaddingBottom>2pt</PaddingBottom>

    <PaddingRight>2pt</PaddingRight>

    <PaddingTop>2pt</PaddingTop>

    <BackgroundColor>#EAE7DF</BackgroundColor>

    <Color>#837F78</Color>

    <TextAlign>Left</TextAlign>

    <FontWeight>Bold</FontWeight>

    <TextDecoration>None</TextDecoration>

    <FontFamily>Trebuchet MS</FontFamily>

    <FontSize>8pt</FontSize>

    <BorderColor>

    <Bottom>#CAC8C0</Bottom>

    </BorderColor>

    <BorderWidth>

    <Bottom>1pt</Bottom>

    </BorderWidth>

    <BorderStyle>

    <Bottom>Solid</Bottom>

    </BorderStyle>

    </Style>

    <CanGrow>true</CanGrow>

    <CanShrink>true</CanShrink>

    <UserSort>

    <SortExpression>=Fields!ColName1.Value</SortExpression>

    </UserSort>

    <Value>Col Name1</Value>

    </Textbox>

    </ReportItems>

    </TableCell>

    <TableCell>

    <ReportItems>

    <Textbox Name="header_ColName2">

    <Style>

    <PaddingLeft>4pt</PaddingLeft>

    <PaddingBottom>2pt</PaddingBottom>

    <PaddingRight>2pt</PaddingRight>

    <PaddingTop>2pt</PaddingTop>

    <BackgroundColor>#EAE7DF</BackgroundColor>

    <Color>#837F78</Color>

    <TextAlign>Left</TextAlign>

    <FontWeight>Bold</FontWeight>

    <TextDecoration>None</TextDecoration>

    <FontFamily>Trebuchet MS</FontFamily>

    <FontSize>8pt</FontSize>

    <BorderColor>

    <Bottom>#CAC8C0</Bottom>

    </BorderColor>

    <BorderWidth>

    <Bottom>1pt</Bottom>

    </BorderWidth>

    <BorderStyle>

    <Bottom>Solid</Bottom>

    </BorderStyle>

    </Style>

    <CanGrow>true</CanGrow>

    <CanShrink>true</CanShrink>

    <UserSort>

    <SortExpression>=Fields!ColName2.Value</SortExpression>

    </UserSort>

    <Value>Col Name2</Value>

    </Textbox>

    </ReportItems>

    </TableCell>

    <TableCell>

    <ReportItems>

    <Textbox Name="header_ColName3">

    <Style>

    <PaddingLeft>4pt</PaddingLeft>

    <PaddingBottom>2pt</PaddingBottom>

    <PaddingRight>2pt</PaddingRight>

    <PaddingTop>2pt</PaddingTop>

    <BackgroundColor>#EAE7DF</BackgroundColor>

    <Color>#837F78</Color>

    <TextAlign>Right</TextAlign>

    <FontWeight>Bold</FontWeight>

    <TextDecoration>None</TextDecoration>

    <FontFamily>Trebuchet MS</FontFamily>

    <FontSize>8pt</FontSize>

    <BorderColor>

    <Bottom>#CAC8C0</Bottom>

    </BorderColor>

    <BorderWidth>

    <Bottom>1pt</Bottom>

    </BorderWidth>

    <BorderStyle>

    <Bottom>Solid</Bottom>

    </BorderStyle>

    </Style>

    <CanGrow>true</CanGrow>

    <CanShrink>true</CanShrink>

    <UserSort>

    <SortExpression>=Fields!ColName3.Value</SortExpression>

    </UserSort>

    <Value>Col Name3</Value>

    </Textbox>

    </ReportItems>

    </TableCell>

    <TableCell>

    <ReportItems>

    <Textbox Name="header_ColName4">

    <Style>

    <PaddingLeft>4pt</PaddingLeft>

    <PaddingBottom>2pt</PaddingBottom>

    <PaddingRight>2pt</PaddingRight>

    <PaddingTop>2pt</PaddingTop>

    <BackgroundColor>#EAE7DF</BackgroundColor>

    <Color>#837F78</Color>

    <TextAlign>Right</TextAlign>

    <FontWeight>Bold</FontWeight>

    <TextDecoration>None</TextDecoration>

    <FontFamily>Trebuchet MS</FontFamily>

    <FontSize>8pt</FontSize>

    <BorderColor>

    <Bottom>#CAC8C0</Bottom>

    </BorderColor>

    <BorderWidth>

    <Bottom>1pt</Bottom>

    </BorderWidth>

    <BorderStyle>

    <Bottom>Solid</Bottom>

    </BorderStyle>

    </Style>

    <CanGrow>true</CanGrow>

    <CanShrink>true</CanShrink>

    <UserSort>

    <SortExpression>=Fields!ColName4.Value</SortExpression>

    </UserSort>

    <Value>Col Name4</Value>

    </Textbox>

    </ReportItems>

    </TableCell>

    </TableCells>

    <Height>1mm</Height>

    </TableRow>

    </TableRows>

    </Header>

    <Details>

    <TableRows>

    <TableRow>

    <TableCells>

    <TableCell>

    <ReportItems>

    <Textbox Name="ColName1">

    <Style>

    <BackgroundColor>#F4F1E8</BackgroundColor>

    <PaddingLeft>4pt</PaddingLeft>

    <PaddingBottom>2pt</PaddingBottom>

    <PaddingRight>2pt</PaddingRight>

    <PaddingTop>2pt</PaddingTop>

    <TextAlign>Left</TextAlign>

    <FontFamily>Trebuchet MS</FontFamily>

    <FontSize>8pt</FontSize>

    <BorderColor>

    <Bottom>#CAC8C0</Bottom>

    </BorderColor>

    <BorderWidth>

    <Bottom>1pt</Bottom>

    </BorderWidth>

    <BorderStyle>

    <Bottom>Solid</Bottom>

    </BorderStyle>

    </Style>

    <CanGrow>true</CanGrow>

    <CanShrink>true</CanShrink>

    <Value>=Fields!ColName1.Value</Value>

    </Textbox>

    </ReportItems>

    </TableCell>

    <TableCell>

    <ReportItems>

    <Textbox Name="ColName2">

    <Style>

    <BackgroundColor>#F4F1E8</BackgroundColor>

    <PaddingLeft>4pt</PaddingLeft>

    <PaddingBottom>2pt</PaddingBottom>

    <PaddingRight>2pt</PaddingRight>

    <PaddingTop>2pt</PaddingTop>

    <TextAlign>Left</TextAlign>

    <FontFamily>Trebuchet MS</FontFamily>

    <FontSize>8pt</FontSize>

    <BorderColor>

    <Bottom>#CAC8C0</Bottom>

    </BorderColor>

    <BorderWidth>

    <Bottom>1pt</Bottom>

    </BorderWidth>

    <BorderStyle>

    <Bottom>Solid</Bottom>

    </BorderStyle>

    </Style>

    <CanGrow>true</CanGrow>

    <CanShrink>true</CanShrink>

    <Value>=Fields!ColName2.Value</Value>

    </Textbox>

    </ReportItems>

    </TableCell>

    <TableCell>

    <ReportItems>

    <Textbox Name="ColName3">

    <Style>

    <BackgroundColor>#F4F1E8</BackgroundColor>

    <PaddingLeft>4pt</PaddingLeft>

    <PaddingBottom>2pt</PaddingBottom>

    <PaddingRight>2pt</PaddingRight>

    <PaddingTop>2pt</PaddingTop>

    <TextAlign>Right</TextAlign>

    <FontFamily>Trebuchet MS</FontFamily>

    <FontSize>8pt</FontSize>

    <BorderColor>

    <Bottom>#CAC8C0</Bottom>

    </BorderColor>

    <BorderWidth>

    <Bottom>1pt</Bottom>

    </BorderWidth>

    <BorderStyle>

    <Bottom>Solid</Bottom>

    </BorderStyle>

    </Style>

    <CanGrow>true</CanGrow>

    <CanShrink>true</CanShrink>

    <Value>=Fields!ColName3.Value</Value>

    </Textbox>

    </ReportItems>

    </TableCell>

    <TableCell>

    <ReportItems>

    <Textbox Name="ColName4">

    <Style>

    <BackgroundColor>#F4F1E8</BackgroundColor>

    <PaddingLeft>4pt</PaddingLeft>

    <PaddingBottom>2pt</PaddingBottom>

    <PaddingRight>2pt</PaddingRight>

    <PaddingTop>2pt</PaddingTop>

    <TextAlign>Right</TextAlign>

    <FontFamily>Trebuchet MS</FontFamily>

    <FontSize>8pt</FontSize>

    <BorderColor>

    <Bottom>#CAC8C0</Bottom>

    </BorderColor>

    <BorderWidth>

    <Bottom>1pt</Bottom>

    </BorderWidth>

    <BorderStyle>

    <Bottom>Solid</Bottom>

    </BorderStyle>

    </Style>

    <CanGrow>true</CanGrow>

    <CanShrink>true</CanShrink>

    <Value>=Fields!ColName4.Value</Value>

    </Textbox>

    </ReportItems>

    </TableCell>

    </TableCells>

    <Height>1mm</Height>

    </TableRow>

    </TableRows>

    </Details>

    <TableColumns>

    <TableColumn>

    <Width>47.625mm</Width>

    </TableColumn>

    <TableColumn>

    <Width>50.00625mm</Width>

    </TableColumn>

    <TableColumn>

    <Width>28.575mm</Width>

    </TableColumn>

    <TableColumn>

    <Width>21.43125mm</Width>

    </TableColumn>

    </TableColumns>

    </Table>

    </ReportItems>

    <Height>1mm</Height>

    </Body>

    <rd:ReportID>930ced99-44c5-4de6-a8df-88f62a69b81c</rd:ReportID>

    <DataSets>

    <DataSet Name="DefaultDataSet">

    <Query>

    <rd:UseGenericDesigner>true</rd:UseGenericDesigner>

    <CommandText>EMPTY</CommandText>

    <DataSourceName>DefaultDataSource</DataSourceName>

    </Query>

    <Fields>

    <Field Name="ColName1">

    <DataField>Col Name1</DataField>

    <rd:TypeName>System.String</rd:TypeName>

    </Field>

    <Field Name="ColName2">

    <DataField>Col Name2</DataField>

    <rd:TypeName>System.DateTime</rd:TypeName>

    </Field>

    <Field Name="ColName3">

    <DataField>Col Name3</DataField>

    <rd:TypeName>System.Int32</rd:TypeName>

    </Field>

    <Field Name="ColName4">

    <DataField>Col Name4</DataField>

    <rd:TypeName>System.Int32</rd:TypeName>

    </Field>

    </Fields>

    </DataSet>

    </DataSets>

    <Width>147.6375mm</Width>

    <Language>en-US</Language>

    </Report>  

     
    Friday, February 10, 2006 7:08 PM
  • Hi Brian,
     
    I forget to mention how we bind the data to the ReportViewer.  Below is the code.  You can find the DataType for each column in the DataSets section in RDL.  Thanks. 

    DataTable table;

    ...

    ReportDataSource source = new ReportDataSource("DefaultDataSet", table);

    this.rptViewer.LocalReport.DataSources.Clear();

    this.rptViewer.LocalReport.DataSources.Add(source);

    this.rptViewer.DataBind();

    Saturday, February 11, 2006 1:30 AM
  • Hi Brain,
     
    One of our team members has spent time reading the page source and found the report rendering problem in Firefox.  I hope it's useful for your investigation.  Please see below.
     

    The ReportViewer control creates a huge number of nested tables and div tags. Firefox 1.5 (though not FF 1.0.7) chokes on an empty table cell with a width of 100% that’s in one of these tables. This cell’s measurement attributes seem to take precedence over other sized elements and cause the columns in the report to crunch down to tiny unreadable widths. Removing this table cell from the DOM fixes the rendering error completely.

    The specific table cell is located in the first nested table inside the div classed “ReportvieweroReport”. That div contains a table with a table-body element, containing a single row, containing two table cells. The first of these table cells has the id “mp01_bodyRegion__ctl1__ctl0_ReportVieweroReportCell”. The *second* of these two cells is empty, but is set to width=”100%” and height=”0”. This cell breaks the layout in Firefox 1.5.

    (var ClientReportmp01_bodyRegion__ctl1__ctl0_ReportViewer__ctl2 = new RSReport(ClientControllermp01_bodyRegion__ctl1__ctl0_ReportViewer, "mp01_bodyRegion__ctl1__ctl0_ReportViewer", "mp01_bodyRegion__ctl1__ctl0_ReportVieweroReportDiv", "mp01_bodyRegion__ctl1__ctl0_ReportVieweroReportCell", "100", "", 1, 7, false, false, "", 0);)
    Monday, February 13, 2006 5:09 PM
  • Thank you.  We are aware of that issue, but I did not know it was unique to more recent versions of FireFox.
    Monday, February 13, 2006 6:40 PM
  • Hi Brian,
     
    We found another rendering problem in Firefox.  Please see below. 
     
    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.
     
    Thanks.
    Monday, February 13, 2006 11:54 PM
  • Has there been any progress on this bug?  My app is crippled right now, since Firefox doesn't handle the reporting properly.

    If there is not a fix, perhaps some advice would be nice - I am using the TableRdlGenerator/RdlGenerator code from www.gotreportviewer.com.  I've modified the code somewhat, but I don't see a very good way to get it to render the textbox fix I've seen elsewhere.  Any thoughts on that?

    Thank you!

    Nolan

    Thursday, March 02, 2006 8:58 PM
  • I have not tried this myself, but you might be able to solve the problem by placing the textbox inside a rectangle.  Textboxes get special handling in some cases.  Adding the rectangle won't affect the display of the report but may change the html that is generated to workaround the problem.
    Monday, March 06, 2006 10:56 PM
  • Hi!

    I am running into the same problem and there are no empty cells in the table. Saving the source from FireFox for the table it can be displayed correctly in IE, but not the other way around. I am using the VS 2005 to create the report rdl. Here is the simple report that can not be displayed properly in FF.

    <?xml version="1.0" encoding="utf-8"?>
    <Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
      <DataSources>
        <DataSource Name="DataSource">
          <DataSourceReference>DataSource</DataSourceReference>
          <rd:DataSourceID>87206147-a9f0-4f42-9d6e-79af4f8a7231</rd:DataSourceID>
        </DataSource>
      </DataSources>
      <BottomMargin>1in</BottomMargin>
      <RightMargin>1in</RightMargin>
      <rd:DrawGrid>true</rd:DrawGrid>
      <InteractiveWidth>8.5in</InteractiveWidth>
      <rd:SnapToGrid>true</rd:SnapToGrid>
      <Body>
        <ReportItems>
          <Table Name="table1">
            <Left>0.25in</Left>
            <KeepTogether>true</KeepTogether>
            <Top>0.125in</Top>
            <Width>348.99985pt</Width>
            <Details>
              <TableRows>
                <TableRow>
                  <TableCells>
                    <TableCell>
                      <ReportItems>
                        <Textbox Name="textbox4">
                          <rd:DefaultName>textbox4</rd:DefaultName>
                          <ZIndex>1</ZIndex>
                          <Style>
                            <PaddingLeft>2pt</PaddingLeft>
                            <PaddingBottom>2pt</PaddingBottom>
                            <PaddingRight>2pt</PaddingRight>
                            <PaddingTop>2pt</PaddingTop>
                          </Style>
                          <CanGrow>true</CanGrow>
                          <Value>=Fields!name.Value</Value>
                        </Textbox>
                      </ReportItems>
                    </TableCell>
                    <TableCell>
                      <ReportItems>
                        <Textbox Name="textbox5">
                          <rd:DefaultName>textbox5</rd:DefaultName>
                          <Style>
                            <PaddingLeft>2pt</PaddingLeft>
                            <PaddingBottom>2pt</PaddingBottom>
                            <PaddingRight>2pt</PaddingRight>
                            <PaddingTop>2pt</PaddingTop>
                          </Style>
                          <CanGrow>true</CanGrow>
                          <Value>=Fields!created.Value</Value>
                        </Textbox>
                      </ReportItems>
                    </TableCell>
                  </TableCells>
                  <Height>0.25in</Height>
                </TableRow>
              </TableRows>
            </Details>
            <TableColumns>
              <TableColumn>
                <Width>2.22222in</Width>
              </TableColumn>
              <TableColumn>
                <Width>2.625in</Width>
              </TableColumn>
            </TableColumns>
            <Height>18pt</Height>
          </Table>
        </ReportItems>
        <Height>700pt</Height>
      </Body>
      <rd:ReportID>bd8ca714-0aa5-4b6e-9760-58d82cd24f8a</rd:ReportID>
      <LeftMargin>1in</LeftMargin>
      <DataSets>
        <DataSet Name="DataSet1">
          <Query>
            <rd:UseGenericDesigner>true</rd:UseGenericDesigner>
            <CommandText>select top 2 name, created from vault</CommandText>
            <DataSourceName>DataSource</DataSourceName>
          </Query>
          <Fields>
            <Field Name="name">
              <rd:TypeName>System.String</rd:TypeName>
              <DataField>name</DataField>
            </Field>
            <Field Name="created">
              <rd:TypeName>System.DateTime</rd:TypeName>
              <DataField>created</DataField>
            </Field>
          </Fields>
        </DataSet>
      </DataSets>
      <Width>522pt</Width>
      <InteractiveHeight>11in</InteractiveHeight>
      <Language>en-US</Language>
      <TopMargin>1in</TopMargin>
    </Report>
    Tuesday, April 25, 2006 1:17 PM
  • Hi my name is barbara and I am having the same problem with firefox would like to know if there is a solution.  I have realized if I save the report.axd to a html and where the oReportCell is add the width=100% then it works however how do I do that on the fly?  I tried adding a .css class where #oReportCell{ width=100%} however that does not seem to work? can anyone help?
    Wednesday, August 09, 2006 4:45 PM
  • Barbara, I tried the same fix and had no success. I believe it's getting lost in the sea of nested tables and iframes. The only way I've found to work around this so far is to add a textbox set to the width of the post.
    Saturday, September 30, 2006 8:35 AM
  • Hi Jon,

    What do you mean "add a textbox set to the width of the post."? I have been stuggling with this issue for a couple of days. Is this something you do in the rdlc or progromatically? Can you provide a simple example or explaination?

    This control is perfect for simple reports that can be exported. All except the fact that it doesn't render correctly in Firefox!

    Thanks,
    Craig

    Monday, October 02, 2006 7:11 PM
  • Jon,

    Git it figured out. I just added a blank text box in the header and set it to the width of the report. Pretty much exactly what you said :)

    Thanks,
    Craig

    • Proposed as answer by Ted Reid Friday, June 13, 2008 8:13 PM
    Monday, October 02, 2006 7:25 PM
  • Brian,

    Is there a hotfix available to resolve the "narrow width" issue when the ReportViewer renders columns in Firefox?  We're seeing the same error with Firefox 2.x, and our client is considering a switch to Crystal Reports if we cannot resolve the issue promptly for them. 

    Please contact me at jeff.townes@parivedasolutions.com with any information you may have.

    Thanks,

    Jeff

    Tuesday, November 21, 2006 9:57 PM
  • Hi there,

    I have just come across this problem. I am using Firefox version 1.5.0.9. I have tried to insert this textbox set to report width as mentioned by "asbuilts", but it has not solved the issue. Below I have provided the html from the reportview.aspx showing where I have placed the text box. I guess there must be an issue with my text box settings if this truely works:

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="ReportView.aspx.cs" Inherits="ReportView" %>

    <%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

    Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >

    <head runat="server">

    <title>Untitled Page</title>

    <input type=text style="width:100%"/> <<-----------TEXT BOX PLACED HERE

    </head>

    <body style="height:100%; width:100%; margin:0px; padding:0px;">

    <form id="form1" runat="server">

    <div style="width:100%; height:100%;">

    <div style="width: 100%; background-color: buttonface;">

    <asp:Button ID="Button1" runat="server" Text="Previous" style="float:right;" OnClick="Button1_Click" Enabled="False"/>

    </div>

    <rsweb:ReportViewer ID="ReportViewer1" runat="server" style="width:100%; height:440px;" OnPreRender="ReportViewer1_OnPreRender" Font-Names="Verdana" Font-Size="0.9em"

    ProcessingMode="Remote" ShowPrintButton="False" ShowZoomControl="False" ShowCredentialPrompts="False" ShowDocumentMapButton="False" ShowParameterPrompts="False">

    <ServerReport ReportServerUrl="" />

    </rsweb:ReportViewer>

    </div>

    </form>

    </body>

    </html>

    If anyone has tried this with success or if "asbuilt is reading this can you show an actual example. It would be much appreciated and would kind of put this post to rest.

    Cheers

    Mike

    Wednesday, January 31, 2007 12:29 PM
  • Adding a rectangle to the report and moving all of the elements from my report INSIDE of this rectangle solved the issue for me. It's the only thing that seems to work.
    Monday, May 14, 2007 7:36 PM
  • Hi there,

     

    Could you explain what type of rectangle this is (Div, .NET Object?????). I am using Visual Studio 2005.

     

    Cheers

     

    Mike 

    Tuesday, May 15, 2007 10:51 AM
  • The reference is to a textbox in the report itself.  I am using a matrix report with no header or footer specifically for inclusion in another page using the ReportViewer control.  I experienced the same issue until I inserted a blank textbox in the report page (using Report Builder although Report Designer should work too).  The textbox should be the same width as the matrix and can be placed behind the matrix so it doesn't take much display space (HTML requires that it will take some space, just very little).

    The column headers do not follow in FireFox (they do in IE) when scrolling down, but that is the only issue I have remaining.

    Hope this helps.

    Pete


    SQL2005 SP2
    FireFox 2.0
    Sunday, July 01, 2007 1:47 PM
  •  

    I came up with a complicated but effective solution to ReportViewers dire styling problems in Firefox. I am using a combination of CSS styling and a ResponseFilter to dynamically re-write the ReportViewer HTML and remove empty cells, amongst other things.

     

    Feel free to pick over the code below and see if you can get it working.

     

    Code Block

     

      Public Class ReportingFilter
            Inherits Stream
            Private _sink As Stream
            Private _position As Long
            Dim oOutput As New StringBuilder

            Public Sub New(ByVal sink As Stream)
                _sink = sink
            End Sub

            Public Overrides ReadOnly Property CanRead() As Boolean
                Get
                    Return True
                End Get
            End Property

            Public Overrides ReadOnly Property CanSeek() As Boolean
                Get
                    Return True
                End Get
            End Property

            Public Overrides ReadOnly Property CanWrite() As Boolean
                Get
                    Return True
                End Get
            End Property

            Public Overrides Sub Flush()
                _sink.Flush()
            End Sub

            Public Overrides ReadOnly Property Length() As Long
                Get
                    Return _sink.Length
                End Get
            End Property

            Public Overrides Property Position() As Long
                Get
                    Return _sink.Position
                End Get
                Set(ByVal value As Long)
                    _sink.Position = value
                End Set
            End Property

            Public Overrides Function Read(ByVal buffer() As Byte, ByVal offset As Integer, ByVal count As Integer) As Integer
                Return _sink.Read(buffer, offset, count)
            End Function

            Public Overrides Function Seek(ByVal offset As Long, ByVal origin As System.IO.SeekOrigin) As Long
                Return _sink.Seek(offset, origin)
            End Function

            Public Overrides Sub SetLength(ByVal value As Long)
                _sink.SetLength(value)
            End Sub

            Public Overrides Sub Write(ByVal buffer() As Byte, ByVal offset As Integer, ByVal count As Integer)

                Dim szBuffer As New String(UTF8Encoding.UTF8.GetString(buffer, offset, count))

                'A Closing HTML tag indicates the response object has finished recieving the entire content of the page
                If InStr(szBuffer, "") > 0 Then
                    oOutput.Append(szBuffer)

                    Dim szCompleteBuffer As New String(oOutput.ToString)
                    Dim szStyle As New String("")
                    Dim reStyle As New RegularExpressions.Regex("style=""(.*?)""")
                    Dim classIndex As Integer

                    classIndex = 0

                    'Replace report viewer images with ones in a less excessively secure path
                    Dim rsReportImage As New RegularExpressions.Regex("SRC=""([^""]*?)unsorted.gif""")
                    szCompleteBuffer = rsReportImage.Replace(szCompleteBuffer, "SRC=""/v2/images/report_unsorted.gif""")

                    rsReportImage = New RegularExpressions.Regex("SRC=""([^""]*?)sortDesc.gif""")
                    szCompleteBuffer = rsReportImage.Replace(szCompleteBuffer, "SRC=""/v2/images/report_sortDesc.gif""")

                    rsReportImage = New RegularExpressions.Regex("SRC=""([^""]*?)sortAsc.gif""")
                    szCompleteBuffer = rsReportImage.Replace(szCompleteBuffer, "SRC=""/v2/images/report_sortAsc.gif""")

                    rsReportImage = New RegularExpressions.Regex("SRC=""([^""]*?)sortAsc.gif""")
                    szCompleteBuffer = rsReportImage.Replace(szCompleteBuffer, "SRC=""/v2/images/report_sortAsc.gif""")

                    rsReportImage = New RegularExpressions.Regex("SRC=""([^""]*?)TogglePlus.gif""")
                    szCompleteBuffer = rsReportImage.Replace(szCompleteBuffer, "SRC=""/v2/images/report_TogglePlus.gif""")

                    rsReportImage = New RegularExpressions.Regex("SRC=""([^""]*?)ToggleMinus.gif""")
                    szCompleteBuffer = rsReportImage.Replace(szCompleteBuffer, "SRC=""/v2/images/report_ToggleMinus.gif""")

                    'To ensure we don't hang pages, we only loop until an arbitrary total or all styles have been replaced
                    Do Until reStyle.IsMatch(szCompleteBuffer) = False Or classIndex = 100

                        Dim strCurrentMatch As New String(reStyle.Match(szCompleteBuffer).Value)

                        Dim reCurrentMatch As New RegularExpressions.Regex(strCurrentMatch)
                        Dim reMatch As RegularExpressions.MatchCollection

                        reMatch = reCurrentMatch.Matches(szCompleteBuffer)

                        If reMatch.Count > 0 Then


                            Dim CurrentMatchStyle As New String("")
                            CurrentMatchStyle = strCurrentMatch.Replace("style=""", "").Replace("""", "")

                            'Replace superfluous styles out of the current class
                            CurrentMatchStyle = CurrentMatchStyle.Replace("word-wrap:break-word;", "")
                            CurrentMatchStyle = CurrentMatchStyle.Replace("overflow-x:hidden", "")
                            CurrentMatchStyle = CurrentMatchStyle.Replace("padding-left:2pt;padding-top:2pt;padding-right:2pt;padding-bottom:2pt;", "padding:2pt;")
                            CurrentMatchStyle = CurrentMatchStyle.Replace("direction:LTR;unicode-bidi:Normal;text-align:Left;writing-mode:lr-tb;", "")
                            CurrentMatchStyle = CurrentMatchStyle.Replace("background-color:Transparent;background-repeat:Repeat;", "")
                            CurrentMatchStyle = CurrentMatchStyle.Replace("vertical-align:Top;", "vertical-align:Middle;")
                            If CurrentMatchStyle = "overflow:auto;HEIGHT:100%;WIDTH:100%" Then CurrentMatchStyle = ""
                            'If the only style in this class is just width or height settings then discard them, they're evil!
                            If (InStr(CurrentMatchStyle, "WIDTH", CompareMethod.Binary) > 0 Or InStr(CurrentMatchStyle, "HEIGHT", CompareMethod.Binary) > 0) And Not InStr(CurrentMatchStyle, ";") > 0 Then
                                szCompleteBuffer = szCompleteBuffer.Replace(strCurrentMatch, "")
                            ElseIf CurrentMatchStyle.Length > 0 Then
                                szCompleteBuffer = szCompleteBuffer.Replace(strCurrentMatch, "class=""r" & classIndex.ToString & """")
                                szStyle &= vbCrLf & ".r" & classIndex & " {" & CurrentMatchStyle & "}"
                            Else
                                szCompleteBuffer = szCompleteBuffer.Replace(strCurrentMatch, "")
                            End If

                            'Else
                            'szCompleteBuffer = szCompleteBuffer.Replace(strCurrentMatch, strCurrentMatch.Replace("style=", "styleIgnored="))

                        End If

                        classIndex += 1


                    Loop

                    'Consolidate multiple class tags into one
                    reStyle = New RegularExpressions.Regex("]*?class=""r([^>]*?)""[^>]*?class=""r([^>]*?)""[^>]*?>", RegularExpressions.RegexOptions.IgnoreCase)
                    szCompleteBuffer = reStyle.Replace(szCompleteBuffer, "")

                    'Replace empty TD tags with zero widths or heights... these are completely pointless and cause firefox to mess up the reports
                    reStyle = New RegularExpressions.Regex("]*?)width=""0""([^>]*?)>|]*?)height=""0""([^>]*?)>", RegularExpressions.RegexOptions.IgnoreCase)
                    szCompleteBuffer = reStyle.Replace(szCompleteBuffer, "")

                    szStyle &= vbCrLf & ".trOver td,.trOverFixed td {background:#666666;color:#FFFFFF;}"
                    szStyle &= vbCrLf & ".trOverFixed td {background:#333333;color:#FFFFFF;}"
                    szStyle &= vbCrLf & ".trOver td a, .trOverFixed td a {color:#FFFFFF;}"

                    Dim javascript As String
                    'javascript = " "
                    javascript = " "

                    'Append the inline stylesheet right before the closing head tag, which will always put it in the head
                    szCompleteBuffer = szCompleteBuffer.Replace("", " " & vbCrLf & javascript & vbCrLf & "")
                    szCompleteBuffer = szCompleteBuffer.Replace("

                    'szCompleteBuffer = szCompleteBuffer.Replace("", "")

                    Dim data() As Byte
                    data = UTF8Encoding.UTF8.GetBytes(szCompleteBuffer)

                    _sink.Write(data, 0, data.Length)
                Else
                    oOutput.Append(szBuffer)
                End If
            End Sub
        End Class

     

     

    And the CSS, which uses a div with an ID of FirefoxFix wrapped around the control.

    Code Block

    <style type="text/css">

    #FirefoxFix div#<%=ReportViewer1.UniqueID.ToString.Replace("$","_")%>oReportDiv table tr td {width:auto !important;}

    #FirefoxFix div#<%=ReportViewer1.UniqueID.ToString.Replace("$","_")%>oReportDiv table {width:100% !important;}

    #FirefoxFix div#<%=ReportViewer1.UniqueID.ToString.Replace("$","_")%>oReportDiv table tr td {word-wrap:normal !important;}

    #ReportNavigation {background:#EEEEEE;text-align:right;}

    #<%=PNLReportViewer.UniqueID.ToString.Replace("$","_")%> {padding-bottom:30px;}

    #<%=ReportViewer1.UniqueID.ToString.Replace("$","_")%>_ctl01 {position:absolute;bottom:-30px;right:0px;border:1px solid #CCCCCC;width:100%;}

    #<%=ReportViewer1.UniqueID.ToString.Replace("$","_")%>_ctl01 table {float:right;}

    #FirefoxFix {position:relative;z-index:0;}

    /* Fix left navigation so it appears above the report */

    div#navigation ul {z-index:10;}

    </style>

    <!--[if IE]>

    <style type="text/css">

    #FirefoxFix div {width:100% !important;}

    /*#FirefoxFix td img {display:block;float:left;}*/

    #FirefoxFix td#ctl00_ContentPlaceHolder1_ReportViewer1_ReportViewer1oReportCell {width:auto !important;}

    #FirefoxFix td#ctl00_ContentPlaceHolder1_ReportViewer1_ReportViewer1oReportCell table tr td table tr td {width:auto !important;}

    #FirefoxFix td#ctl00_ContentPlaceHolder1_ReportViewer1_ReportViewer1oReportCell table tr td table {width:100% !important;}

    #<%=PNLReportViewer.UniqueID.ToString.Replace("$","_")%> {padding-bottom:30px;}

    #<%=ReportViewer1.UniqueID.ToString.Replace("$","_")%>_ctl01 {position:absolute;bottom:0px;right:0px;border:1px solid #CCCCCC;width:100%;}

    #<%=ReportViewer1.UniqueID.ToString.Replace("$","_")%>_ctl01 table {float:right;}

    #FirefoxFix {position:relative;z-index:0;}

    </style>

    <![endif]-->

     

     

     

    Monday, January 21, 2008 3:15 PM
  • I know that this thread has been dormant for quite some time, but I found some useful stuff within it, and found a reasonably easy workaround mentioned before in this thread.
    My workaround required 2 steps:
    - add an empty textbox to the bottom of the report that spanned the width of the entire report.
    - Add the following line of code to your page "ReportViewer1.Attributes.Add("style", "overflow:scroll;");" where ReportViewer1 represents your own report viewer.

    This totally worked for me.

    Thanks!

    Ted
    • Edited by Ted Reid Friday, June 13, 2008 8:12 PM Acknowledging prior submission of fix
    Friday, June 13, 2008 8:10 PM
  • Woodeh,
       How did you hook in your class?  Do you override one of the ReportViewer methods?

    Wednesday, July 02, 2008 10:48 PM
  • Thanks for the lead Woodeh!  kkam - you hook into this via the Response.Filter property on the web page hosting the ReportViewer control.  I have posted a more full example on StackOverflow at:  http://stackoverflow.com/questions/1133026/ssrs-2005-css-not-applied-on-first-column/2734392#2734392
    Thursday, April 29, 2010 2:20 AM