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
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...
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.
Nikolay Demirev
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
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.
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.
Nikolay Demirev
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
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