Bind RadDocument to RichTextBox

6 posts, 0 answers
  1. Amol
    Amol avatar
    4 posts
    Member since:
    Aug 2012

    Posted 07 Aug 2012 Link to this post

    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
  2. Amol
    Amol avatar
    4 posts
    Member since:
    Aug 2012

    Posted 08 Aug 2012 Link to this post

    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...
  3. DevCraft banner
  4. Nikolay Demirev
    Admin
    Nikolay Demirev avatar
    103 posts

    Posted 10 Aug 2012 Link to this post

    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.

  5. Amol
    Amol avatar
    4 posts
    Member since:
    Aug 2012

    Posted 10 Aug 2012 Link to this post

    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.

  6. Nikolay Demirev
    Admin
    Nikolay Demirev avatar
    103 posts

    Posted 10 Aug 2012 Link to this post

    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.

  7. Azadeh
    Azadeh avatar
    11 posts
    Member since:
    Mar 2012

    Posted 18 Aug 2012 Link to this post

    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
Back to Top
DevCraft banner