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

    NOV rich text view supports saving of text documents to TXT, RTF, DOCX, HTML, EPUB, PDF, NTB, and NTX formats. Note that only the latter two will fully persists all the information in the document as the control supports features not present in HTML, RTF, and DOCX. TXT format will preserve only the text content of the document, i.e. all formatting will be lost.

     Save to File or Stream Directly

    To save synchronously to a Nevron Binary Text Document local file call the SaveToLocalFile method of the rich text view. This method doesn't work on sandboxed platforms like Blazor WebAssembly.

    Save to a Nevron Binary Rich Text file synchronously
    Copy Code
    richTextView.SaveToLocalFile(@"D:\Documents\MyTextDocument.ntb");
    

    To save a rich text document to a file asynchronously call the SaveToFileAsync method of the rich text view. Calling this method shows a loader over the rich text view until the saving completes. The method returns a promise, which you can use to get notified when the saving completes.

    Save to a Nevron Binary Rich Text file asynchronously
    Copy Code
    richTextView.SaveToFileAsync(@"D:\Documents\MyTextDocument.ntb").Then(
        delegate (bool success)
        {
        },
        delegate (Exception ex)
        {
        }
    );
    

    To save a rich text document to a stream call the SaveToStream method of the rich text view and pass the text format to save to:

    Save to Nevron Binary Text Document stream
    Copy Code
    richTextView.SaveToStream(stream, NTextFormat.NevronBinary);
    
     Show a Save File Dialog

    To show the standard Save File dialog, use the SaveAsAsync method:

    Save File dialog
    Copy Code
    richTextView.SaveAsAsync();
    

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

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