Rich Text Editor / Loading and Saving Documents / Word Documents (DOCX)
In This Topic
    Word Documents (DOCX)
    In This Topic

    NOV rich text view lets you easily load and save document as Microsoft Word Documents in the DOCX file format.

     Loading Word Documents

    To load a Word Document from a file or from a stream you can use the Load methods of the rich text view as shown in the Loading Documents topic. For example:

    Loading a Word Document from a local file
    Copy Code
    richTextView.LoadFromLocalFile(@"C:\MyDocument.docx");
    
     Saving Word Documents

    To save a document as a Word Document to a file or to a stream you can use the Save method of the rich text view as shown in the Saving Documents topic. For example:

    Saving a Word Document to a local file
    Copy Code
    richTextView.SaveToLocalFile(@"C:\MyDocument.docx");
    

    Word Documents in the DOCX format are essentially a package that consists of XML and image files and is compressed to a ZIP archive. By default, NOV rich text view uses a medium compression level when creating a Word DOCX package. The medium compression level is a nice compromise between speed and compression ratio. If you want to change the compression level of a DOCX package, you should pass an NDocxSaveSettings instance with the proper value set to its CompressionLevel to the Save method.

    Saving a Word Document with a different compression level
    Copy Code
    NDocxSaveSettings saveSettings = new NDocxSaveSettings();
    saveSettings.CompressionLevel = ENCompressionLevel.BestCompression;
    m_RichTextView.SaveToLocalFile(@"C:\MyDocument.docx", NTextFormat.Docx, saveSettings);
    
    See Also