The LoadText method accepts a physical file, a FileStream, a string or a byte array to load documents into the web editor.

This sample shows how to load a document in the controller and pass it as a ViewModel to the view in order to load a document.

In the controller method Index, the document is loaded into a MemoryStream and then stored in the ViewModel Document that holds the document as a Base64 encoded string. This ViewModel is returned to the actual view.

Loading...

In the view, the Base64 encoded string is converted back into a byte array and loaded using the LoadText method into the web editor.

Loading...

Download the sample from GitHub and test it on your own.