1.7 Adding Word-Processing Capabilities to Your Application with FreeTextBox

The default HTML TextBox and TextArea controls allow your users to write text and upload it to your application. That’s about where the functionality stops. Your users can’t use different fonts or colors, create bulleted lists, add images, and so on. But there may be plenty of times when your users will want to do these things (for example, when adding documents to a document management system, sending emails, or adding comments to a blog).

FreeTextBox is an HTML editor that can easily be integrated into your applications. It gives your users a lot of the word-processing functionality they have become accustomed to, including the ability to:

  • Adjust font styles, colors, and sizes

  • Insert hyperlinks

  • Insert images

  • Use numbered and bulleted lists

  • Change paragraph alignments

FreeTextBox includes both a Design view and an HTML view, so users who are familiar with HTML can directly edit the HTML.

FreeTextBox at a Glance

Tool

FreeTextBox

Version covered

3.1.5

Home page

http://www.freetextbox.com

Power Tools page

http://www.windevpowertools.com/tools/24

Summary

An HTML editor web control that lets you easily add word-processor-like functionality to your applications

License type

Freeware

Online resources

Forums, demos

Supported Frameworks

.NET 1.1, 2.0

Getting Started

Get started by downloading the .zip archive from the Download link at the project’s home page and extracting it to a local directory. Inside that directory, you will find folders for Versions 1.0, 1.1, and 2.0 of the .NET Framework, each of which holds the FreeTextBox.dll for the corresponding Framework version. You will need to select the appropriate version and copy it to your application’s bin directory. If you are using Visual Studio, just add a reference to the correct assembly, and it will be copied for you (see the Appendix).

FreeTextBox includes a wealth of icons and images that are actually embedded in the assembly. In ASP.NET 2.0 this is handled for you automatically, but if you are using ASP.NET 1.1 you will need to register an additional HTTP handler in web.config. Instructions and troubleshooting steps are included in the readme.txt file.

Using FreeTextBox

Now that you’ve added FreeTextBox to your project, you can start using it just like a normal ASP.NET control. You can add it to the toolbox using the normal Choose Toolbox Items dialog (see the Appendix), or just manually add the required tags:

<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="FreeTextBoxExample.aspx.cs" Inherits="FreeTextBoxExample" %>
<%@ Register Assembly="FreeTextBox" Namespace="FreeTextBoxControls"
TagPrefix="FTB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <FTB:FreeTextBox ID="FreeTextBox1" runat="server">
        </FTB:FreeTextBox>
    </div>
    </form>
</body>
</html>

Running this page displays the FreeTextBox control (Figure 1-15).

FreeTextBox’s Design view

Figure 1-15. FreeTextBox’s Design view

You can use the design surface and the icons at the top to create your HTML document, or you can switch to the HTML tab to edit the HTML directly, as shown in Figure 1-16.

FreeTextBox’s HTML view

Figure 1-16. FreeTextBox’s HTML view

From the server side, you can easily access or set the value of the FreeTextBox using its Text property. You can then save the HTML to the database, send it out in an email, or use it in whatever way you need to.

Getting Support

Support is provided through forums at the tool’s home page.

Get Windows Developer Power Tools now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.