Access RTF in a Range or selection?!

  • Thread starter Jean-Guy Marcil
  • Start date
J

Jean-Guy Marcil

Leon_Amirreza was telling us:
Leon_Amirreza nous racontait que :
I need to access the Selected Text in RTF format and send RTF Text to
Word in a C# App.
I cant use Copy and Paste becuase it ruins the information user has
put in clipboard and more importantly becuase the program reads data
from a Database in RTF format and it would be weay tooo slow to paste
the data into word.

I dunno how to read from or write RTF text into a word document that
is already open in word?

What are you trying to do?
From your description it looks like you want to transfer selected text in a
Word document to another document without using Copy/Paste and while
preserving the formatting.

If that is the case, lookup the FormattedText property of the Range object.
For example, to copy the current selection with its formatting to the fourth
paragraph in the same document:

Dim rgeCurrent As Range
Dim rgeTarget As Range

Set rgeCurrent = Selection.Range
Set rgeTarget = ActiveDocument.Paragraphs(4).Range

rgeTarget.FormattedText = rgeCurrent

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
J

Jean-Guy Marcil

Leon_Amirreza was telling us:
Leon_Amirreza nous racontait que :
I want to transfer a large volume of text in RTF format in a database
to an empty document.


I am afraid that your only option is to go through he clipboard which will
act as a the RTF converter for Word when you paste into Word.

Also, some RichTextBox control have a SaveFile property. You can use that to
create a temporary RTF file from the Database RTF field, then open that
temporary file and transfer the code form that temp file to the target one.
Of course, if all you want to do is transfer the stuff out of the database
to a new file, that temporary file will be your actual final file. Just open
it in Word and Save it as a doc file.

You might be best served by posting in an Access group.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
L

Leon_Amirreza

I need to access the Selected Text in RTF format and send RTF Text to Word
in a C# App.
I cant use Copy and Paste becuase it ruins the information user has put in
clipboard and more importantly becuase the program reads data from a
Database in RTF format and it would be weay tooo slow to paste the data into
word.

I dunno how to read from or write RTF text into a word document that is
already open in word?
 
L

Leon_Amirreza

I want to transfer a large volume of text in RTF format in a database to an
empty document.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top