Styled HTML Field



Note:  This product is no longer for sale.

Convert styled text to HTML in your Xojo applications.  Plus, a drop-in solution for creationg HTML emails for use with the Xojo email classes.

Now at version 2.0.10

Looking for a way to turn styled text from a Xojo TextArea control into HTML? Here’s a set of classes that handles it for you. It makes producing HTML and HTML emails extremely simple. The PWStyleHTMLField class:

  • Converts styled text from a styled TextField or TextArea to HTML
  • Has built-in support for producing HTML emails
  • Offers support for embedded images in HTML email messages
  • Offers extensive support for links
  • Lets you add custom HTML to support images and other styling and entities that can’t be displayed in a TextArea/Editfield
  • Supports paragraph alignment
  • Offers built-in Undo
  • Is compatible with REALbasic 2009R2.1 (and possibly earlier) to the latest version of Xojo
  • Costs only $50.00 USD to license the encrypted classes for use in your applications The encrypted version is no longer being offered.
  • Costs only $150.00 USD to license the unencrypted classes for use in your applications



If you are a standard license holder, please contact us about an upgrade.

Demo Application - Mac OS X

Demo Application - Windows

Professional Source Code Archive (Encrypted)

Decryptor for Mac OS X

Decryptor for Windows

Known Limitations

It is not possible to create more than one link to the same word/phrase.  For example, if you wanted to create multiple links with the phrase “click here” you could only do it on one instance.  To fix this requires an overhaul of the link management engine.

If you need this functionality, take a look at the Formatted Text Control.


Note:  This product is no longer for sale.

Standard License (encrypted classes): $50 If you are a standard license holder, please contact us for an upgrade.

Professional License (full source code – unencrypted): $150


PWStyleHTMLField Version History

Version 2.0.10

  • Added ConnectionType for secure connections with ability to choose SSL2, SSL23, SSL3, TLSv1 and TLSv11, TLSV12 for R3 when it’s released.
  • Added Paragraph Alignment to the demo application
  • Removed PWEmbedImageSMTP. Now uses TCPSecureSocket but secure set to false for non-secure connections.
  • Fixed deprecated items with current Xojo replacements.
  • Fixed items found in project check
  • Fixed old BKeeney URL’s in the demo app

Version 2.0.9

  • Fixed error in alignment when a link was the only thing on the line.

Version 2.0.8

  • Added PWEmbedImageSMTPSecure class to allow developers to use secure SMTP mail servers (like GMail)
  • Fixed color conversion to HTML issue (Real Studio added Opacity to color)

Version 2.0.7

  • Changed branding to BKeeney Software Inc.
  • Added “?” and “=” to characters that PWStyleHTMLField no longer encodes by default in URLs.
  • Added public NonEscapedLinkCharacters property to PWStyleHTMLField allow developers to specify characters in URLs they don’t want to have encoded (overrides the default set of #, ?, and =).
  • Improved the algorithm used for detecting link text.
  • Added a SetBaseSize method that takes an integer argument, for setting the HTML body text size.
  • Removed backward compatibility to versions of REALbasic that support the EditField class;
  • PWStyleHTMLField now requires support for the Real Studio TextArea class.


Version 2.0.6

  • Re-fixed Windows alignment issue originally fixed in version 2.0.3.
  • Restored the UseWindowsAlignmentWorkaround boolean property which can allow you to turn off the abovementioned fix if Real Studio’s TextArea is ever fixed for this problem.
  • Restored the “CSSDemoWin” demonstration of how you can easily add functionality to PWStyleHTMLField.

Version 2.0.5

  • “#” within links is no longer encoded so that anchors will work properly.
  • Improved algorithm for replacing leading spaces with “ ”.
  • Improved algorithm for detecting font differences between styled text to produce cleaner HTML.

Version 2.0.4

  • Removed dependence on a menubar (and its Edit Undo/Redo items) for PWStyleHTMLField.
  • Added Register function to PWEmbedImageSMTP class to enable add-on functionality.
  • Fixed a problem with PWEmbedImageSMTP that allowed an extraneous character in image references in some situations.
  • Cleaned up a few unused local variables that were causing compile-time warnings in later versions of Real Studio.

Version 2.0.3

  • Worked around a bug in Real Studio that causes TextArea RTFData to omit all but the first alignment tag in Win32 builds, thus breaking PWHTMLField’s alignment feature in Windows.

Version 2.0.2

  • Added an EditSource event to PWStyleHTMLField which allows you to edit the HTML source before it’s rendered. You can use this in a custom subclass to define your own features.
  • Added AlwaysEncode property that tells PWStyleHTMLField to apply HTMLEncoding to output obtained from HTML method. (HTMLEmailMessage.BodyHTML is already HTML-encoded.)
  • Added EncodeSpaces property which converts spaces to their HTML entity “ ” so that they’ll be displayed in the output (HTML strips plain spaces). It only encodes spaces when there is more than one in a row. Any spaces that come after a Return character are always encoded.
  • Added TabSpaces property that lets you set the number of spaces to replace Tab characters with — requires that your PWStyleHTMLField instance has AcceptTabs enabled.
  • Added a TableWidth property for output from the HTML function. Sets the table width to the percentage for this Integer value. For example, TableWidth = 100 translates to <table width=’100%’>. The default is 98. Setting TableWidth to 0 omits the table. Does not apply to HTMLEmailMessage’s BodyHTMLText, where there is always a table with a width of 98%.
  • Added DisableBackgroundTasks property to both PWStyleHTMLField and PWEmbedImageSMTP classes. When set to true, sets the DisableBackgroundTasks pragma in all methods/functions that have loops.
  • Added ability to escape “<” character so that it appears in HTML output and doesn’t prevent display of everything following it.
  • Made public properties for PWStyleHTMLField and PWEmbedImageSMTP classes available in the IDE’s Properties pane.
  • Fixed a problem with an alignment change at the top of a page throwing off paragraph alignment below in some situations.
  • Slight change to the PreviewWin to try to fix some rendering issues when the window is reopened in a testing session.

Version 2.0.1

  • Commented out code in an unused method in PWEmbedImageSMTP that raised a Deprecated alert when using RS’s Analyze function.
  • Added Help button for Embedded Image functionality.

Version 2.0

  • PWStyleHTMLField and PWEmbedImageSMTP now work together to send messages with Quoted-Printable encoding.
  • Added subject encoding (which you can replace if desired) for email clients that require it.
  • Fixed an issue with alignment not working properly in some cases when the first paragraph is not left-aligned.
  • Style specification is no longer applied to links in normal (i.e. non-email HTML).
  • Fixed a problem with sending embedded images that have a space in their names to Microsoft Outlook and Entourage.


Leave a Reply