In a recent blog entry, we showed how to load a local document using pure Javascript and an HTML input element. In this second part, we show how to hide the HTML input element and to overwrite the Open functionality in the ribbon bar.

The input element is hidden using the CSS property display:

Loading...

Using Javascript, a new event is attached to the Load menu item of the ribbon bar. The newly attached event is raised before it is bubbled to Web.TextControl. This enables the cancellation of the default functionality of the ribbon item in order to add your own action:

Loading...

When clicking the Open menu item now, the local Open File dialog is opened. Users can now upload local files or files from connected cloud services such as OneDrive:

HTML5: Loading local documents - Part 2

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

GitHub

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)