Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 RTF to Text conversion

Author  Topic 

Shaka De Virgo
Starting Member

3 Posts

Posted - 2012-09-19 : 19:23:39
I wasn't sure if this post should go here, but here we go...

I'm using SQL Server 2012. I have a table where we are storing RTF data in one of the columns.

Now we have to convert this RTF data and store the "plain text" in a new table.

I have checked other posts I found in this website (http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=89973, http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=90034, http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=123437, http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=178760), but unfortunately these solutions haven't really removed all the RTF tags from the source code.

In our current setup, using an external control (like "RICHTEXT.RichtextCtrl") is not an option. Everything should be done using an SQL function / stored procedure.

Could anyone help me tackle this? I can provide a couple of good examples of our RTF code, and how the text looks like after using the conversion method posted by lionofdezert and SwePeso in the mentioned posts above.

thanks.

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2012-09-20 : 01:47:55
Ok, could you supply some example of RTF code and intended results

Jack Vamvas
--------------------
http://www.sqlserver-dba.com
Go to Top of Page

Shaka De Virgo
Starting Member

3 Posts

Posted - 2012-09-20 : 07:59:51
I have a file that I can send but honestly I don't know if I can attach it here, or how (I can't find a way to do that yet)... Could you give me some hints?

Thanks!
Go to Top of Page

Shaka De Virgo
Starting Member

3 Posts

Posted - 2012-09-20 : 08:10:34
While I find a way to attach a file to my post, here you go (I copied / pasted from the *.txt file I have ready to attach).

{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 MS Sans Serif;}{\f1\fnil\fprq2\fcharset0 MS Sans Serif;}}

{\colortbl ;\red0\green0\blue0;}

\paperw12240\paperh15840\margl1800\margr1800\margt1440\margb1440\viewkind4\uc1pard\qc\cf1\f0\fs20 I'll take a walk outside\par

I'm surrounded by some kids at play\par

I can feel their laughter\par

So why do I sear?\cf0\f1\fs15\par

\cf1\f0\fs20\par

Poor and twisted thoughts that spin around my head\par

I'm spinnin'\par

I
'm spinnin' how quick the sun can drop away\par

\par

And now my bitter hands\par

Cradle broken glass\par

Of what was everything\par

\par

\i All the pictures have been washed in black\par

And tattooed everything\par

All the love gone bad \par


Has turned my world to black\par

And tattooed all I see\par

\par

All that I am\par

All that I'll be\cf0\i0\f1\fs15\par

}






I'll take a walk outside
I'm surrounded by some kids at play
I can feel their laughter
So why do I sear?

Poor and twisted thoughts that spin around my head
I'm spinnin'
I'm spinnin' how quick the sun can drop away

And now my bitter hands
Cradle broken glass
Of what was everything

All the pictures have been washed in black
And tattooed everything
All the love gone bad
Has turned my world to black
And tattooed all I see

All that I am
All that I'll be
Go to Top of Page
   

- Advertisement -