SSRS : Reports Rendering issues with Firefox and Safari Browsers

1 12 2009

As part of our project, we need to execute the reports on different platforms and browsers to check the compatibility of reports in different versions and variants of web browsers. While development was in progress, I could never concentrated on this issue , as I am pretty sure that reports will execute in all the browsers without any hassle. But when I tried to execute the reports in Firefox, Safari and some other third party browsers as part of my unit testing I have noticed that the format of the report is being messed up highly and the structure is weird. I had to spend some more time at the end for the development (of course, it happens for all the software projects) to overcome this issue.

I would like to share with you the knowledge I have obtained as part of my research and also save your time to not go for a detailed research like me.

What is the process behind the Reports Execution in the browsers?

As you might be aware that, Report Manager is a pure web based HTML site. When we deploy our reports which were developed in the BIDS onto the Report Manager, SSRS converts the report definition language into the HTML syntax for the easy rendering of the reports on the server.

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, Safari etc – the IFRAME’s height defaults to a few hundred pixels, so you only see the top 2 inches of the report.

What would be the work around?

The simplest workaround would be install the IE add-on for the Firefox which is available freely at the below location. But this does not solve our whole problem, as it is not practically feasible to install IE add-on in each machine which is used by the end user. We should concentrate in finding the solution at the server level and most importantly at the execution engine level

Download Firefox IE Add-on

https://addons.mozilla.org/en-US/firefox/addon/1419

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.

Workaround # 1:

1. Go to the following Location, where SQLServer is installed…\Program Files\Microsoft SQL Server\MSSQL.3\ReportingServices\ReportServer\Pages

2. Open ReportViewer.aspx File add the style property marked in bold and blue color, Then try this style=”display:table;margin:0px;overflow:hidden”runat=”server”/>

If not Helps the first method, then try the Workaround 2.

Workaround # 2

 /* Fix report IFRAME height for Firefox, Safari */

.DocMapAndReportFrame
{
    Min-height: 860px;
    Min-width: 1000px;
}

 

Put this code at bottom of the ReportingServices.css file. After you added this code, Close your browser and clear your cookies then try again

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.





How To Implement Multi-Lingual (Localized) Reports In SSRS 2008

16 09 2009

As part of my project execution , I had to work on the multi-langauge reports. I literally spent more than 4 hours to find out the information required for my project. Still I could get only bits and pieces of information not  an end-end post on multi-language reports. This situation is inspired me to write a post on this topic.

This post describes the end-end way of implementing multi language reports in the SQL Server 2008 environment. any experienced techie if he follows the example given in this article will be able to create multi-langauge reports in his project. Multi-language reports are also called localized reports in the programming context.

Architectural Process behind  Localization

These reports can support different languages based on the resource files. Resource file is a text based file where we have different strings in english and also their localized meaning in the local language. we need to create one resource file for one langauge. One particular resource file will be loaded by the .NET CLR in to the SSRS 2008 Reporting Processor depends upon the browser langauge of the Report Manager. Reporting Server programming extension acts as the through channel in between .NET CLR and Reporting processor in this communication process.

Sample Multi – Lingual Report In SSRS 2008

Please follow the below example to implement the multi-lingual reports in SSRS 2008.

Go to Start-> SQL Server 2008 -> SQL Server Business intelligence Development

Create the new project in the Report Server project Template. Give the name SampleMultiLingualReport  , save the template.

 1

In the solution explorer right click the Reports folder and add new item.

Select the Report from the Add New Item box. Give the name SampleReport then click the button Add.

2

Drag the textbox from the toolbox and drop into the Report Area.

3

1.      Create the Localization Code (Class Library) in C# or VB.Net in Visual Studio 2008

1.         Open Visual Studio 2008 to create resource files for en-US, en-UK and fr-FR for the English, USA and English, UK and French, France respectively (you can create the same files with either text files as well).

2.         Using Visual Studio Create a new Class Library (VB or C#) I am going to name my Project SSRSAssembly

3.        Rename your Class1.VB or Class1.CS to LocalizedReport, presumably you would have your re-usable methods in this class

4.        Add the following Method to your Class

C#

Public StringGetLocalizedStrings(String strCultureInfo, String strLocalString)

{

// Your C# logic should come here

// Return Localized String

}

5.       Build your project.

2.     Copy the Custom Assembly to the SQL Reporting Services Folders

Once the C# application has been compiled it will generate separate DLL for each resource file in the application Bin directory with the folder names en-US, en-GB and fr-FR.  It also generates the DLL for the Visual Studio project called ssrsAssembly.DLL

Copy en-US, en-GB, fr-FR folders into the below path in your system.

C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PublicAssemblies.

Copy the project ssrsAssembly.DLL into the below mentioned paths in your System.

.Net Path: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies

Report Server Path:  C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer\bin

3.    Add the DLL File to your Reporting Application

To add a reference to your custom assembly, open the Reporting Services report in Report Designer. To do this, follow these steps:

  1. Open the report that will reference the custom assembly.
  2. On the Report menu, click Report Properties.
  3. In the Report Properties dialog box, click the References tab.
  4. Under References, click the ellipsis () button that is next to the Assembly name column header.
  5. In the Add References dialog box, click Browse. (In SQL Server 2005, click the Browse tab.) Locate and then click the custom assembly. Click Open. (In SQL Server 2008, click Add instead of Open.)
  6. In the Add References dialog box, click OK.
  7. In the Report Properties dialog box, click OK.

We are now ready to use the custom assembly in Reporting Services

4.   Call the C# Code into the Report

Now the Report will be able to refer the code in the C# that we have written in the .Net , as we have embedded that DLL in to our Report.

1.Right click the textbox that we have dropped in to our report earlier. Click the menu item Expression from the Menu.

2. Expression editor will be opened. Write the below code in the editor.

=CODE.SSRSAssembly.LocalizedReport.GetLocalizedStrings(User!Language,”Hello”)

Explanation of Above Code

CODE – This is the standard keyword pre defined by SSRS to call the custom assembly Function

SSRSAssembly – This is the name of our C# application name space

LocalizedReport – This is the name of our class library

GetLocalizedStrings – This is the name of our method defined in C# to get the localized strings.

User!Language – This is the built-in variable from SSRS. It defined the browser langauge of the Report.

Hello – it can be any string for which we need a localized meaning. This string should be defined in the all resource files with their corresponding localized meaning.

5.   Update the rssvPolicy.config File in the Report Server  

Open rssvPolicy.config located in C:\Program Files\Microsoft SQL Server\MSSQL.x\Reporting Services\Report Server\bin

Add the below <CodeGroup> after the last <CodeGroup> in the rssvPolicy.config file.

<CodeGroup version=”1″ PermissionSetName=”FullTrust” Description=”reportHelperLib. “>

<IMembershipCondition

Class=”UrlMembershipCondition”

Version=”1″

Url=

“C:\ProgramFiles\MicrosoftSQLServer\MSRS10.MSSQLSERVER\ReportingServices    \ReportServer\bin” />

 </CodeGroup>

6.   Restart the Reporting Services Service

Go to the Control->Administrative Tools -> Services.

Find the SQL Server Reporting services and Restart the Services of SSRS

7.   View Report in the Report Manager

Compile the report, deploy the report onto the report manager and execute the report in different language options by setting language mode at IE->Tools->Appearance->Languages tab of the Internet Explorer.

Limitations

Let me conclude this post by discussing the limitations of localized reports in SQL BI 2008. We can define the localized string for any report item like Report Data,Report Headers, Report Column etc. Only drawback of this feature is we can not apply this logic to the Report Parameters. If you want the Report Parameter also in diffrent languages like the report data it is not possible.

Since Report parametrs can not be defined as the Expressions in SSRS, we can not open the Expression Editor to call the C# code into the Report Parameter definition. Report Parameter always contains static text value.

 

please give your feedback / comments on this topic.

if you need any further help on this please mail me at VK.Sangisetti@GMail.com.