Rich Text Editor / Loading and Saving Documents / Loading Documents
Loading Documents

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

 Load from File or Stream Directly

To load a Nevron rich text document synchronously from a local file call the LoadFromLocalFile method of the rich text view. This method doesn't work on sandboxed platforms like Blazor WebAssembly.

Load a Nevron binary text document file synchronously
Copy Code
richTextView.LoadFromLocalFile(@"D:\Documents\MyTextDocument.ntb");

To load a Nevron rich text document asynchronously call the LoadFromFileAsync method of the rich text view. Calling this method shows a loader over the rich text view until the loading completes. The method returns a promise, which can be used to get notified when the loading completes.

Load a Nevron binary text document file asynchronously
Copy Code
richTextView.LoadFromFileAsync(@"D:\Documents\MyTextDocument.ntb").Then(
    delegate (bool success)
    {
    },
    delegate (Exception ex)
    {
    }
);

To load a rich text document from a stream call the LoadFromStream method of the rich text view and pass the text format to load:

Load from a Nevron binary text document stream
Copy Code
richTextView.LoadFromStream(stream, NTextFormat.NevronBinary);
 Show an Open File Dialog

The OpenFileAsync method shows an Open File dialog with all supported text formats:

Open File dialog
Copy Code
richTextView.OpenFileAsync();

If you want a specific format to be selected by default, pass it as an argument:

Open File dialog with a specific file format selected
Copy Code
richTextView.OpenFileAsync(NTextFormat.NevronBinary);
See Also