0049-89-49053501 support@wptools.de

WPTools File Formats (RTF, DocX, HTML …)

MS Word DOCX Files

Since 2015 optionally available for WPTools 7 is native support for DocX files. You will need Delphi 7 or later since UTF8 support is required. DocX support is activated when you add the units WPIOReadDOCX, WPIoWrtDocX and WPIoZIPDOCX to the project. (WPIoZIPDOCX implements the bridge to the ZIP support. Unless you use Delphi XE2 or later, you also need “abbrevia” for ZIP file support – which you can download at http://tpabbrevia.sourceforge.net/.)

Pretty much all WPTools features are supported in DocX format. Only proprietary WPTools objects, special user properties and sub paragraphs cannot be saved in this format. New: It is now possible to write an marker in the file to make MS Word open the file in track changes mode.

We took care to also save WPReporter band information into regular fields so it is possible to save in DocX, edit a template in MS Word and load the template back.

Here you can order the add-on if you have licensed WPTools 7.23 or later – it includes the source for the DOCX reader and writer.

View WPReporter Template in MS Word

View WPReporter Template in MS Word

Click to go to the download page “sample word processor” …

The demo was compiled with WPTools 7 “Premium“. This demo lets you “play” with the word processing features of our text components. It is just a prototype and comes without any warranty of any kind. In the lower right corner it print “www.WPCubed.com”.

Extendable file-format support in WPTools:

WPTools uses reader and writer classes. This makes it possible to – even in the standard version which does not contain all of the source code – to extend or to modify the way files are loaded and saved. The latest programming techniques have been used to make the reading and writing fast and save. WPTools reads and writes its own “WPTOOLS” format, ANSI, RTF and HTML/CSS texts. There is also an add-on to support MS Word DocX files natively, too.

Reader and Writer Classes

WPTools uses an extensible concept to support file formats. It is possible to create and adapt reader and writer classes.

Features supported in RTF files

  • loaded RTF reference
  • Page format and Margins
    Header and Footer texts
  • Images in BMP, WMF, JPEG and PNG format
  • Stylesheets
  • subtractive styles
  • Numbering Stylesheets (\list ..)
  • Tables
  • Fields
  • References and bookmarks (TOC!)
  • Nested Tables
  • Paragraph Attributes, i.e. indent and spacing, justification
  • Character Attributes
  • Unicode Characters \u
  • Special WPTools objects

WPTools Premium includes the reporting features and also handles

  • Footnotes
  • Textboxes (text shapes)
  • Columns

Features supported in HTML Files

  • Character attributes, FONT, B, I, U
  • Tables
  • StyleSheets <style>
  • inline CSS styles <p style=””>
  • styles references <p class=””>
  • hyperlinks, also with references to styles <a class=”” href=””>
  • inline span objects <span style=””>, <span class=””>
  • images
  • Ordered and Unordered lists can be loaded. Saving is possible but cannot fully preserve the possibilities of RTF

About “WPTools” Format

WPTools supports attributes known from the RTF and from CSS specification. Unfortunately neither one includes all the possibilities of the other. For example, CSS has no possibility to store tab stops. So you may ask why we do not use XML as file format. Using additional parameters would make it easy to store all the attributes WPTools supports. That would introduce other problems:

Unlike HTML XML requires a clear nesting of tags, this means that each XML TAG has to be closed on the level it was opened. But this would limit the capabilities of WPTools. There are several elements which can be closed on a different level, i.e. hyper links. A hyper link (<A>) can be opened somewhere within one paragraph and be closed within the next. The same is true for bookmarks and of course mail merge fields.

So we decided to create the “WPTOOLS” format to be HTML like, this means it works with TAGs which are using named parameters. The intention was to make the WPTOOLS format readable by HTML readers. Not only to display it in a web browser (which works) but to use it as input for an indexing system. So all indexing systems which can handle HTML can also handle the WPTOOLS format. A general HTML reader will see the plain text and the tables in WPTOOLS format and ignore the embedded images since they have been embedded Base64 encoded escaped by HTML comments.

The “WPTools” or “WPT” format can be extremely useful to debug application. Most attributes are human readable in this format. The “WPAT” properties are stored in a consistent and easy to understand way:

Paragraph styles are defined with a “pstyle” tag which also sets a number for the style. The style attributes are encoded in wpcss format which simply list the attribute name:attribute value. Within WPTools API the attributes can be set suing TParagraph.ASet( id, value ) and read using TParagraph.AGet( id, var value ). Later the style can be referenced inside the div tag using the base attribute.
Character attributes (within WPTools API they are represented by the CharAttr integer which are stored with each character) are first defined using the “cs” tag and later applied using the c tag.

The text encoded above reads: “This is a line of text with a bold word and the style “normal” applied to it.”