views:

222

answers:

2

I have seen samples using Word 9.0 object library. But I have Office 2010 Beta and .NET 4.0 in VS2010. Any tips on how to go with the new Word Dlls?

So I just wanted to get the functionality of RTF to TEXT with .NET3.5 or later.

+2  A: 

Do you really new to load .RTF into Word? .net has RichTextBox control that can handle .RTF files. See here: http://msdn.microsoft.com/en-us/library/1z7hy77a.aspx (How to: Load Files into the Windows Forms RichTextBox Control)

stasetz
+1  A: 

I got a better solution with WPF , using TextRange.

        FlowDocument document = new FlowDocument();

        //Read the file stream to a Byte array 'data'
        TextRange txtRange = null;

        using (MemoryStream stream = new MemoryStream(data))
        {
            // create a TextRange around the entire document
            txtRange = new TextRange(document.ContentStart, document.ContentEnd);
            txtRange.Load(stream, DataFormats.Rtf);
        }

Now you can see the extracted text inside documentTextRange.Text

Jobi Joy