Open Word Document Modify content and Save

2 posts, 0 answers
  1. Sunil
    Sunil avatar
    1 posts
    Member since:
    Mar 2018

    Posted 21 Mar 2018 Link to this post

    Hi,

    I need to open existing word document and  show that document in RadRichTextEditor with extra information (like Name of the person at the top of the document), and also have to add signature and names at the end of the document and save the document. I did using Microsoft.Office.Interop.Word.Document before with DSOFramer control but DSOFramer is having some issues and trying to achieve same using RadRichTextEditor. 

    Appreciate your help as soon as possible.

     

    thank you!

     

  2. Dimitar
    Admin
    Dimitar avatar
    2823 posts

    Posted 23 Mar 2018 Link to this post

    Hi Sunil,

    This is possible with RadRichTextEditor. First, you need to import the document using the format provider: Using DocxFormatProvider. Then you can use the document editor to insert the content. 

    The following snippet shows how you can load the document and insert additional content:
    DocxFormatProvider provider = new DocxFormatProvider();
    using (FileStream inputStream = File.OpenRead(@"..\..\test.docx"))
    {
        this.radRichTextEditor1.Document = provider.Import(inputStream);
    }
     
    var editor = radRichTextEditor1.DocumentEditor;
    editor.Insert("John Doe");
    editor.InsertParagraph();
     
    radRichTextEditor1.Document.CaretPosition.MoveToLastPositionInDocument();
    editor.InsertParagraph();
    editor.Insert("Signature...........");

    Please let me know if there is something else I can help you with. 

    Regards,
    Dimitar
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top