2011-03-05 91 views
0

如何实现对SQL Server报告服务扩展? 我需要为以下内容实现呈现效果:问题实施IRenderingExtesion接口

  1. 将本地化文本应用于报告。
  2. 根据当前的文化报告应用datetime和decimal格式。
  3. 如果任何报告已分配任何报告,则使用已定义的背景图像。

我试过为SQL Server 2008 R2实施IRenderingInterface。 但它给在连接到报告服务我以下:

“Microsoft.SqlServer.ReportingServices2010.RSConnection2010 + MissingEndpointException:连接到该报表服务器失败的尝试检查您的连接信息和报表服务器是一个兼容的版本。--- > System.InvalidOperationException:客户端发现响应内容类型为'',但期望'text/xml'。“

以下是渲染器类继承IRenderingExtension &实现了所需的渲染与LocalizedName财产一起RenderStream方法:

public void GetRenderingResource(Microsoft.ReportingServices.Interfaces.CreateAndRegisterStream createAndRegisterStreamCallback, System.Collections.Specialized.NameValueCollection deviceInfo) 
{ 
    //Render any Embedded Resource in the Report 
} 

public void SetConfiguration(string configuration) 
{ 
    //Used to pass configuration from Reporting Services Config File 
    //to this Reporting Serivces Extension 
} 

public string LocalizedName 
{ 
    get 
    { 
    //A Read only properties which return the name of 
    //this RS extension 
    string p_strName = "Custom Renderer"; 

    System.Globalization.CultureInfo p_CultureInfo = System.Globalization.CultureInfo.CurrentCulture; 

    //Determine the text to be returned (displayed) by 
    // the Name property of CultureInfo class 
    if (p_CultureInfo.Name == "zh-CHS") 
    { 
     p_strName += " (Traditional Chinese)"; 
    } 
    else if (p_CultureInfo.Name == "zh-CHT") 
    { 
     p_strName += " (Simplified Chinese)"; 
    } 
    else if (p_CultureInfo.Name == "en-US") 
    { 
     p_strName += "(Traditional English)"; 
    } 
    return p_strName; 
    } 
} 

public bool Render(
    Microsoft.ReportingServices.OnDemandReportRendering.Report report, 
    System.Collections.Specialized.NameValueCollection reportServerParameters, 
    System.Collections.Specialized.NameValueCollection deviceInfo, 
    System.Collections.Specialized.NameValueCollection clientCapabilities, 
    ref System.Collections.Hashtable renderProperties, 
    Microsoft.ReportingServices.Interfaces.CreateAndRegisterStream createAndRegisterStream) 
{ 
    System.IO.Stream s = createAndRegisterStream(
     report.Name, 
     "html", 
     System.Text.Encoding.UTF8, 
     "text/html", 
     true, 
     Microsoft.ReportingServices.Interfaces.StreamOper.CreateAndRegister); 
    System.IO.StreamWriter sw = new System.IO.StreamWriter(s); 

    sw.WriteLine("<html><body>"); 
    sw.WriteLine("Testing IRenderingExtension."); 
    sw.WriteLine("</body></html>"); 
    sw.Close(); 
    s.Close(); 
    return false; 
} 

public bool RenderStream(
    string streamName, 
    Microsoft.ReportingServices.OnDemandReportRendering.Report report, 
    System.Collections.Specialized.NameValueCollection reportServerParameters, 
    System.Collections.Specialized.NameValueCollection deviceInfo, 
    System.Collections.Specialized.NameValueCollection clientCapabilities, 
    ref System.Collections.Hashtable renderProperties, 
    Microsoft.ReportingServices.Interfaces.CreateAndRegisterStream createAndRegisterStream) 
{ 
    return false; 
} 

回答

0

这可以帮助...

2点可以通过使用覆盖=User.LanguageReport Language field

+0

问题解决了,现在我的工作定位在报表上的文本。我该怎么做? – Kinjal 2011-03-05 13:52:06