Render html code in sql server client report (rdlc)

丶灬走出姿态 提交于 2019-12-06 13:49:23

See Rendering HTML in Reporting Services Text Boxes in SQL Server 2008

I've not tried it and may not apply to rdlc etc, so YMMV

Dear Masoud as GBN mentioned in his link, by default SSRS doesn't provide any solution to Render HTMl from HTML Code block. but you can use one these solution to render HTML in SSRS reports.

  1. Use from SQLCLR to create a Rendered HTML PNG and sendit toyour reports
  2. use HTMLDecoder to decode html code block to Rendered HTML. this script can find at :
  3. You can Use below code block to convert simple html code to Rendered HTML

    Public Shared Function ConvertRtfToText(ByVal input As String) As String
         Dim returnValue As String = String.Empty
            Using converter As New System.Windows.Forms.RichTextBox()
                  converter.Rtf = input
                  returnValue = converter.Text
            End Using
         Return returnValue
    End Function
    

You can also use this code block

 Function RtfToText(ByVal value As String) As String
   If value.Contains("rtf1") Then
       Return System.Text.RegularExpressions.Regex.Replace(System.Text.RegularExpressions.Regex.Replace(System.Text.RegularExpressions.Regex.Replace(System.Text.RegularExpressions.Regex.Replace(value,"[\n\r\f]", ""), "({\\)(.+?)(})|(\\)(.+?)(\b)", ""), "{", ""), "}", "").Trim()
   End If
   Return value
   End Function

you can finally call these code onyour textbox with

  =Code.RtfToText(Fields!HTMLCode.Value)
  1. You can also use some utility like http://pebblereports.com/reportingservicesutilities/ to display Rendered HTML in SSRS
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!