Web.TextControl provides a code-behind API to load and save documents from and to the server. Additionally, local files can be loaded using drag and drop on the control workspace.

Client-side, the Javascript API also provides a method to load local files:

Loading...

This sample shows how to open a local document with the HTML Input element and how to pass this document as a Base64 encoded string to the loadDocument method.

On selecting a new document in the Input element, the document is loaded into a FileReader that asynchronously reads the contents of files. The method readAsDataURL converts the document to a Base64 encoded string automatically. Based on the file extension, the required StreamType is recognized and finally loaded into TX Text Control.

Loading...

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