Re: Formatting RTF data in MS-Word using VB
From: Cindy M -WordMVP- (C.Meister-C_at_hispeed.ch)
Date: 05/31/04
- Next message: Peter Huang: "RE: Inserting files in Word"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 31 May 2004 10:33:08 +0200
Hi Senthil,
There is no mechanism that allows you to put RTF into a Word document
and have it magically transformed into formatted text. A converter is
required. Word's built-in converters execute when you open an RTF file,
use Insert/File, or when pasting RTF from the clipboard.
For the scenario you describe, your best bet could be to save the RTF
to a file, then use an IncludeText field to pick this up. The field can
then be unlinked to turn the content into document text.
Or go the Clipboard route.
> I am doing a mail merge implementation in VB6.0.
> I have a raw unformatted RTF data in my VB6.0 Application.
> This need to be merged to a new word document. When the RTF
> data (which contains Bold, italics, Underline, etc.,) is merged
> I need the RTF to be formatted and displayed.
>
> When I assign the text to the Selection.Text property of the
> ActiveWindow it doesn't format it.
>
> I even tried doing it using the Clipboard object. I copied it to the
> Clipboard by calling the SetText method and giving the format as
> vbCFRTF
> and then when I tried to paste the contents from the clipboard by
> calling the GetText method it pasted the raw unformatted RTF text in
> the word document.
>
> But when I open a new word document and press CTRL-V it gets pasted
> with the formating done.
>
> I am attaching a sample of the text which I need to format when
> displayed in Word document.
>
> {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0
> MS Sans Serif;}}\viewkind4\uc1\pard\f0\fs20 Hi \par\par\b Sub : Test
> data\b0\par\parThis text is in raw RTF format.\parThis when pasted in
> a word document\parneeds to be formatted.\par\parThanks\parSenthil
> kumar S\b\par\b0\i\parHCL Technologies Ltd.,\parNoida.\i0}
>
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.word.mvps.org
This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :-)
- Next message: Peter Huang: "RE: Inserting files in Word"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|