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.
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.
Download the sample from GitHub and test it on your own.
Download and Fork This Sample on GitHub
We proudly host our sample code on GitHub.com/TextControl.
Please fork and contribute.
Requirements for This Sample
- Visual Studio 2012 or better
- TX Text Control .NET Server for ASP.NET (trial sufficient)