Nevron Open Vision Documentation
Rich Text Editor / Loading and Saving Documents / Loading Documents
In This Topic
    Loading Documents
    In This Topic

    NOV rich text view supports loading of text documents from the following formats - TXT, RTF, DOCX, HTML, EPUB, NTB, and NTX.

     Loading Text Documents from File

    Loading text documents from a file is performed with the LoadFromFile method of the NRichTextView object for example:

    Loading a Text Document from File
    Copy Code
    richTextView.LoadFromFile(@"C:\MyDocument.docx");
    

    When you use this method the control will automatically detect the format of the document and if it supports it will be loaded inside the view. In case you want to load a text document in a specific format you can use the override of this method that accepts a text format object:

    Loading a Text Document from File
    Copy Code
    richTextView.LoadFromFile(@"C:\MyDocument.docx", NTextFormat.Docx);
    

    You can also load a document from a file asynchronously, which will show a loader over the rich text view while the document is loading. This is useful when working with large documents.

    Asynchronious Loading from File
    Copy Code
    richTextView.LoadFromFileAsync(@"C:\MyDocument.docx");
    

    If you want to be notified when the document has been loaded, you should subscribe to the DocumentLoaded event of the rich text view.

     Loading Text Documents from Stream

    Similarly to loading text documents from a file the control also supports two methods that allow you to load text documents from a stream:

    Loading a Text Document from Stream
    Copy Code
    richTextView.LoadFromStream(stream);
    

    Again if you want to explicitly specify the text format in the stream you can use:

    Loading a Text Document from Stream
    Copy Code
    richTextView.LoadFromStream(stream, NTextFormat.Docx);
    

    You can also load a document from a stream asynchronously, which will show a loader over the rich text view while the document is loading. This is useful when working with large documents.

    Asynchronious Loading from Stream
    Copy Code
    richTextView.LoadFromStreamAsync(stream);
    

    If you want to be notified when the document has been loaded, you should subscribe to the DocumentLoaded event of the rich text view.

     

    See Also