Friday, February 24, 2012

Display RTF String

Hi,
I have a rtf string saved in a SQL Server Db which i want to display on the
report. The string is forumlated as:{\rtf1\ansi\ansicpg1252\uc1 aaa}
Is this possible in SSRS? If yes then kindly provide some help on the
implementation.Rich text and html is not supported in this release or Yukon, Html will be
supported in the next release after SQL 2005 but I do not know about rich
text...
You could create your own rich text textbox and in custom dll and add it to
the tools ...
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Afaq" <Afaq@.discussions.microsoft.com> wrote in message
news:51F23E7F-ACEE-4FD1-AA43-93F6EF0C86B0@.microsoft.com...
> Hi,
> I have a rtf string saved in a SQL Server Db which i want to display on
> the
> report. The string is forumlated as:{\rtf1\ansi\ansicpg1252\uc1 aaa}
> Is this possible in SSRS? If yes then kindly provide some help on the
> implementation.
>|||How do i add a custom control to the report? I created a rtf user control -
after adding it in the report designer toolbox - it is disabled for selection.
Pardon my ignorance here. I am using SSRS 2000.
--
Afaq
"Wayne Snyder" wrote:
> Rich text and html is not supported in this release or Yukon, Html will be
> supported in the next release after SQL 2005 but I do not know about rich
> text...
> You could create your own rich text textbox and in custom dll and add it to
> the tools ...
> --
> Wayne Snyder, MCDBA, SQL Server MVP
> Mariner, Charlotte, NC
> www.mariner-usa.com
> (Please respond only to the newsgroups.)
> I support the Professional Association of SQL Server (PASS) and it's
> community of SQL Server professionals.
> www.sqlpass.org
> "Afaq" <Afaq@.discussions.microsoft.com> wrote in message
> news:51F23E7F-ACEE-4FD1-AA43-93F6EF0C86B0@.microsoft.com...
> > Hi,
> >
> > I have a rtf string saved in a SQL Server Db which i want to display on
> > the
> > report. The string is forumlated as:{\rtf1\ansi\ansicpg1252\uc1 aaa}
> >
> > Is this possible in SSRS? If yes then kindly provide some help on the
> > implementation.
> >
>
>|||You can't do this for RS 2000. I gather that this will be possible with RS
2005.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Afaq" <Afaq@.discussions.microsoft.com> wrote in message
news:1CA44862-75D4-4248-8EE5-11EE59995451@.microsoft.com...
> How do i add a custom control to the report? I created a rtf user
> control -
> after adding it in the report designer toolbox - it is disabled for
> selection.
> Pardon my ignorance here. I am using SSRS 2000.
> --
> Afaq
>
> "Wayne Snyder" wrote:
>> Rich text and html is not supported in this release or Yukon, Html will
>> be
>> supported in the next release after SQL 2005 but I do not know about rich
>> text...
>> You could create your own rich text textbox and in custom dll and add it
>> to
>> the tools ...
>> --
>> Wayne Snyder, MCDBA, SQL Server MVP
>> Mariner, Charlotte, NC
>> www.mariner-usa.com
>> (Please respond only to the newsgroups.)
>> I support the Professional Association of SQL Server (PASS) and it's
>> community of SQL Server professionals.
>> www.sqlpass.org
>> "Afaq" <Afaq@.discussions.microsoft.com> wrote in message
>> news:51F23E7F-ACEE-4FD1-AA43-93F6EF0C86B0@.microsoft.com...
>> > Hi,
>> >
>> > I have a rtf string saved in a SQL Server Db which i want to display on
>> > the
>> > report. The string is forumlated as:{\rtf1\ansi\ansicpg1252\uc1 aaa}
>> >
>> > Is this possible in SSRS? If yes then kindly provide some help on the
>> > implementation.
>> >
>>|||Uh Oh...
So to summarise- i cant display rtf in SSRS 2000
--
Afaq
"Bruce L-C [MVP]" wrote:
> You can't do this for RS 2000. I gather that this will be possible with RS
> 2005.
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "Afaq" <Afaq@.discussions.microsoft.com> wrote in message
> news:1CA44862-75D4-4248-8EE5-11EE59995451@.microsoft.com...
> > How do i add a custom control to the report? I created a rtf user
> > control -
> > after adding it in the report designer toolbox - it is disabled for
> > selection.
> >
> > Pardon my ignorance here. I am using SSRS 2000.
> >
> > --
> > Afaq
> >
> >
> > "Wayne Snyder" wrote:
> >
> >> Rich text and html is not supported in this release or Yukon, Html will
> >> be
> >> supported in the next release after SQL 2005 but I do not know about rich
> >> text...
> >>
> >> You could create your own rich text textbox and in custom dll and add it
> >> to
> >> the tools ...
> >>
> >> --
> >> Wayne Snyder, MCDBA, SQL Server MVP
> >> Mariner, Charlotte, NC
> >> www.mariner-usa.com
> >> (Please respond only to the newsgroups.)
> >>
> >> I support the Professional Association of SQL Server (PASS) and it's
> >> community of SQL Server professionals.
> >> www.sqlpass.org
> >>
> >> "Afaq" <Afaq@.discussions.microsoft.com> wrote in message
> >> news:51F23E7F-ACEE-4FD1-AA43-93F6EF0C86B0@.microsoft.com...
> >> > Hi,
> >> >
> >> > I have a rtf string saved in a SQL Server Db which i want to display on
> >> > the
> >> > report. The string is forumlated as:{\rtf1\ansi\ansicpg1252\uc1 aaa}
> >> >
> >> > Is this possible in SSRS? If yes then kindly provide some help on the
> >> > implementation.
> >> >
> >>
> >>
> >>
>
>|||Nope.
--
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Afaq" <Afaq@.discussions.microsoft.com> wrote in message
news:F1541CCC-4609-4BCF-8684-FD8C553AB6AD@.microsoft.com...
> Uh Oh...
> So to summarise- i cant display rtf in SSRS 2000
> --
> Afaq
>
> "Bruce L-C [MVP]" wrote:
>> You can't do this for RS 2000. I gather that this will be possible with
>> RS
>> 2005.
>>
>> --
>> Bruce Loehle-Conger
>> MVP SQL Server Reporting Services
>> "Afaq" <Afaq@.discussions.microsoft.com> wrote in message
>> news:1CA44862-75D4-4248-8EE5-11EE59995451@.microsoft.com...
>> > How do i add a custom control to the report? I created a rtf user
>> > control -
>> > after adding it in the report designer toolbox - it is disabled for
>> > selection.
>> >
>> > Pardon my ignorance here. I am using SSRS 2000.
>> >
>> > --
>> > Afaq
>> >
>> >
>> > "Wayne Snyder" wrote:
>> >
>> >> Rich text and html is not supported in this release or Yukon, Html
>> >> will
>> >> be
>> >> supported in the next release after SQL 2005 but I do not know about
>> >> rich
>> >> text...
>> >>
>> >> You could create your own rich text textbox and in custom dll and add
>> >> it
>> >> to
>> >> the tools ...
>> >>
>> >> --
>> >> Wayne Snyder, MCDBA, SQL Server MVP
>> >> Mariner, Charlotte, NC
>> >> www.mariner-usa.com
>> >> (Please respond only to the newsgroups.)
>> >>
>> >> I support the Professional Association of SQL Server (PASS) and it's
>> >> community of SQL Server professionals.
>> >> www.sqlpass.org
>> >>
>> >> "Afaq" <Afaq@.discussions.microsoft.com> wrote in message
>> >> news:51F23E7F-ACEE-4FD1-AA43-93F6EF0C86B0@.microsoft.com...
>> >> > Hi,
>> >> >
>> >> > I have a rtf string saved in a SQL Server Db which i want to display
>> >> > on
>> >> > the
>> >> > report. The string is forumlated as:{\rtf1\ansi\ansicpg1252\uc1 aaa}
>> >> >
>> >> > Is this possible in SSRS? If yes then kindly provide some help on
>> >> > the
>> >> > implementation.
>> >> >
>> >>
>> >>
>> >>
>>|||Actually you can, but it requires code in an external assembly.
Here is one option:
1. Create a ClassLibrary project in C# or VB.NET.
2. Add a reference to the System.Windows.Forms.dll
3. Create a class such as ConversionUtility
4. Add the appropriate import/using statement using
System.Windows.Forms; to your class.
5. Create a method that uses the RichTextBox WinForms control to do the
heavy-lifting:
public static string ConvertRTFToText(string RTF)
{
RichTextBox richTextBox = new RichTextBox();
richTextBox.Rtf = richText;
return richTextBox.Text;
}
6. Compile this assembly, and deploy it to your ReportServer folder or
the GAC
7. Reference the Assembly from the Report and call this method.
The result is a text version of the RTF. It will not include any
formatting, embedded pictures, or markup, however the text will show up
just fine. I use this approach with J.D. Edwards XE One World software
because they have a "Media Objects" table containing key information
input by the users.
Note: This approach is a bit of a hack because of its abuse of the
RichTextBox control. Another route would be to buy or find an RTF
Conversion class library so you don't have the overhead of the windows
forms control.
Hope this gives you another option.
Lance
http://www.lance-hunt.net/|||Lance,
Thanks for the reply. The RTF string if converted to text is useless to me
as it loses its formatiing.
Can we parse it to html and display it?
Afaq Choonawala
"Lance" wrote:
> Actually you can, but it requires code in an external assembly.
> Here is one option:
> 1. Create a ClassLibrary project in C# or VB.NET.
> 2. Add a reference to the System.Windows.Forms.dll
> 3. Create a class such as ConversionUtility
> 4. Add the appropriate import/using statement using
> System.Windows.Forms; to your class.
> 5. Create a method that uses the RichTextBox WinForms control to do the
> heavy-lifting:
> public static string ConvertRTFToText(string RTF)
> {
> RichTextBox richTextBox = new RichTextBox();
> richTextBox.Rtf = richText;
> return richTextBox.Text;
> }
> 6. Compile this assembly, and deploy it to your ReportServer folder or
> the GAC
> 7. Reference the Assembly from the Report and call this method.
> The result is a text version of the RTF. It will not include any
> formatting, embedded pictures, or markup, however the text will show up
> just fine. I use this approach with J.D. Edwards XE One World software
> because they have a "Media Objects" table containing key information
> input by the users.
> Note: This approach is a bit of a hack because of its abuse of the
> RichTextBox control. Another route would be to buy or find an RTF
> Conversion class library so you don't have the overhead of the windows
> forms control.
> Hope this gives you another option.
> Lance
> http://www.lance-hunt.net/
>|||Not likely. Any HTML would end up encoded so it would only show the
literal HTML tags on the page.
At this point, I'm out of ideas. Frankly the only other options are a
bit too extreme and painful. Such as writing your own custom
RenderingExtension so that it will "properly" handle your RTF. Even
with this approach it would be a chore.
Good luck...
Lance

No comments:

Post a Comment