This is a migrated thread and some comments may be shown as answers.

Loading a docx into RadRichTextBox from a remote server

2 Answers 105 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Mel
Top achievements
Rank 1
Mel asked on 17 Nov 2011, 10:46 PM
Greetings,
I have the handle to a URL stream  -
Uri(file.URI + "?render=stream"UriKind.Absolute);
where the file.URI is the file's complete URL and the render on the server is a php function that will send the file over as a stream.
How do I use this to load directly into a RadRichTextBox?
Thanks,
Mel

2 Answers, 1 is accepted

Sort by
0
Dave Navarro
Top achievements
Rank 2
answered on 19 Nov 2011, 01:55 AM
Hello,

I need to load a .docx file from a server too but without the php function on the backend. I've read through a lot of the help docs but haven't figured it out yet.

If you should find a solution would you please post it here? I'll do the same!

Many thanks in advance,

~ Dave
0
Iva Toteva
Telerik team
answered on 22 Nov 2011, 08:24 PM
Hi Mel,

As long as you can obtain a stream with the content of the file in a specific format, you can load it in the rich text box in the following way:

IDocumentFormatProvider formatProvider = DocumentFormatProvidersManager.GetProviderByExtension(".docx");
this.editor.Document = formatProvider.Import(stream);

You can find more information on the format providers in this article.

@Dave:
Please refer to this forum thread for a demo project showing how a file can be loaded from the server using WebClient.

Kind regards,
Iva Toteva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
RichTextBox
Asked by
Mel
Top achievements
Rank 1
Answers by
Dave Navarro
Top achievements
Rank 2
Iva Toteva
Telerik team
Share this question
or