Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

vbscript to convert rtf to asp with no files involved

594 views
Skip to first unread message

James Nash

unread,
Feb 23, 2001, 8:12:44 PM2/23/01
to
Thought someone might have some clue on something I've been wracking my
brains over.

I'm trying to convert a field from rtf to txt in dts using vbscript, so I
need something like

Function convertRTFStringToTxt(rtfString)

' Do some magic here to make the conversion using a rich edit control or
Microsoft word automation

rtfString = BrandNewTxtString

end function

Have any recommendations on what I should use? Some COM component, may Rich
Edit or Microsoft Word Automation? Where would I find the interface
descriptions for those. Most of what I've found talks about opening docs,
and as you can see I have the string already and don't need to write it to a
doc, since I'm writing it to a db.

thanks,

Jamie

Roland Schoofs

unread,
Feb 26, 2001, 3:23:30 PM2/26/01
to
On Sat, 24 Feb 2001 01:12:44 GMT, "James Nash" <nas...@home.com> wrote:

>Function convertRTFStringToTxt(rtfString)
>' Do some magic here to make the conversion using a rich edit control or
>Microsoft word automation

If you have the control in your HTML page (with an <OBJECT> tag) you can use
the object's ID to get the text like this:

s = TheControlsID.Text()

Hardly magic, but this may not be what you mean.
Of course, if don't have working with user input in a RTF control, but you
do have an RTF string, you can use a control to do the conversion for you:

// This is VBScript, use ActiveXObject() in Javascript
set rtf = CreateObject("RICHTEXT.RichtextCtrl")
rtf.TextRTF = YourRtfString
s = rtf.Text
set rtf = nothing

Hope this helps.

James Nash

unread,
Feb 28, 2001, 9:57:10 AM2/28/01
to
Okay,
Here's what I did inside a dts package....
Function Main()
dim rtf
set rtf = CreateObject("RICHTEXT.RichtextCtrl.1")
rtf.TextRTF = DTSSource("SpecNotes") 'Error here
DTSDestination("SpecNotes") = rtf.Text
set rtf = nothing
Main = DTSTransformStat_OK
End Function

I get an error on the rtf.TextRtf line...Type Mismatch, any ideas?

"Roland Schoofs" <rol...@shire.demon.nl> wrote in message
news:f5el9tkk8ba9tsvqa...@4ax.com...

0 new messages