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

Bind RadDocument to RichTextBox

5 Answers 165 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Amol
Top achievements
Rank 1
Amol asked on 07 Aug 2012, 06:14 PM
Dear Team,

I am using telerik controls of version 2012.2.730.1040. I am facing issue in binding RadDocument to RichText Box.
I have byte[] in .doc format and want to assign it to RadDocument. But while using Import function of RadDocument i got error of Dir not found!.
RadDocument radDocument = new RadDocument();                     
MemoryStream mystream = new MemoryStream(ProposalDocumentUIInfo.DocInPDF);
using (MemoryStream stream = mystream)                     
{
DocxFormatProvider provider = new DocxFormatProvider();
this.radDocument = provider.Import(stream);    ....ERROR : Dir not found!
}

Please see attched error

5 Answers, 1 is accepted

Sort by
0
Amol
Top achievements
Rank 1
answered on 08 Aug 2012, 01:02 PM
I am using silverlight telerik controls of version 2012.2.730.1040. I am  unable to import byte[] of .docx filie into Telerik Rich Text Box through RadDocument.
I don't want to show Save / Open dialog box to open document in Rich Text Box.
If i try to import byte[] it gives me Dir not found error.
Code:                   
using
 (Stream stream = mystream)
{                        
DocxFormatProvider provider = new DocxFormatProvider();                       
this.radDocument = provider.Import(stream);                    
}

I also tried other way through Isolated file storage. i saved byte [] to isolated storage space as .docx file and try to import it in to RadDocument then also it gives me error of Dir not found.
Code: Reading from Isolated Storage sape

 using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication())
                {
                    using (IsolatedStorageFileStream isoStream = new IsolatedStorageFileStream(FileName, FileMode.Open, FileAccess.Read, isoStore))
                    {                        
                        DocxFormatProvider provider = new DocxFormatProvider();
                         using (Stream stream = isoStore.OpenFile(FileName, FileMode.Open, FileAccess.Read))
                        {
                            richTextEditor.RadDocument = provider.Import(stream);     ..........Dir not found
                        }
                    }
                }



Is there is any another way to import apart from open dialog box. If yes reply me please...
0
Nikolay Demirev
Telerik team
answered on 10 Aug 2012, 08:05 AM
Hi Amol,

RadRichTextBox supports the format docx, I noticed in your code that you use ProposalDocumentUIInfo.DocInPDF. Probably you are trying to open a pdf document, which is not supported by RadRichTextBox. In your first post you also mention doc - a file format which is not supported either. You can refer to this article for a list of supported formats.

As for your code, I tested both snippets you provided and both work for docx documents. If you are opening docx document and still get this error, please send us the document, so that we can investigate the issue.

Regards,
Nikolay Demirev
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Amol
Top achievements
Rank 1
answered on 10 Aug 2012, 11:22 AM
Hi,
Thanks for the reply But Rich Text Box is not supporting .doc is very bad. because i have .doc file want to open in Rich Text Box. Is there any other way to convert it into .docx.

0
Nikolay Demirev
Telerik team
answered on 10 Aug 2012, 12:48 PM
Hi,

You can use some other 3rd party tools to convert document formats, or MS tools and utilities like the following:

http://www.microsoft.com/downloads/details.aspx?familyid=941b3470-3ae9-4aee-8f43-c6bb74cd1466&displaylang=en

http://blogs.msdn.com/b/ericwhite/archive/2008/09/19/bulk-convert-doc-to-docx.aspx

I hope this helps.

All the best,
Nikolay Demirev
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Azadeh
Top achievements
Rank 1
answered on 18 Aug 2012, 01:58 PM
Hi,
i work with telerik version Q2 2012 sp1 and i want to Make a Editor for docx and doc File with radrichtextbox. 
at first i thought it's easy but now have problic and i'm working on it some last days.
i install related Telerik demo and put a docx file sample in sampledate folder and change source to load this doc instead the xamlfile.
but after load form . its show nothing . can u please put a sample for me?
thanks
Azadeh
Tags
RichTextBox
Asked by
Amol
Top achievements
Rank 1
Answers by
Amol
Top achievements
Rank 1
Nikolay Demirev
Telerik team
Azadeh
Top achievements
Rank 1
Share this question
or