More Related Content
Similar to Wp Tools6 Manual
Similar to Wp Tools6 Manual (20)
Wp Tools6 Manual
- 1. WPTools 6
GUIDE
15.07.2009
Copyright 2005 - 2009 by WPCubed GmbH
created by Julian Ziersch
- 2. I WPTools Version 6
Table of Contents
Foreword 0
Part I What is WPTools? 1
Part II WPTools 6 new features 3
Part III WPTools Version 6 5
Part IV License 7
Part V Technical Notes 8
Part VI PDF Products 9
Part VII Guide 11
1 Localization - change Language in Dialogs
................................................................................................................................... 14
2 Programming Overview/QuickStart
................................................................................................................................... 18
Modify the look and feel of the editor
......................................................................................................................................................... 18
Change current w riting mode
......................................................................................................................................................... 19
Move the ......................................................................................................................................................... 19
Cursor
Change Page Size and Page margins
......................................................................................................................................................... 19
Insert Text
......................................................................................................................................................... 19
Mail Merge (replace fields w ith data)
......................................................................................................................................................... 19
Input TextObjects (i.e. page numbers)
......................................................................................................................................................... 19
Create an ......................................................................................................................................................... 19
ow n toolbar
Save and load HTML
......................................................................................................................................................... 19
Get and set the text "as string"
......................................................................................................................................................... 20
3 Data Structures
................................................................................................................................... 20
4 WYSIWYG
................................................................................................................................... 25
5 Mail-merge and forms
................................................................................................................................... 27
Create Field
......................................................................................................................................................... 28
I
nputM ergeField
.................................................................................................................................................. 28
I
nputE ditField.................................................................................................................................................. 29
ReplaceTokens .................................................................................................................................................. 29
Low Level .................................................................................................................................................. 30
Customize Field Display
......................................................................................................................................................... 31
Update Field (Insert Text from Database)
......................................................................................................................................................... 32
Start Merge process
.................................................................................................................................................. 32
E vent OnMailMergeGetText
.................................................................................................................................................. 33
TWP MnsertTextContents
M I ........................................................................................................................................... 33
procedure Clear...................................................................................................................................... 34
procedure Abort...................................................................................................................................... 34
procedure LoadTextFromStream(s: TStream)
...................................................................................................................................... 34
procedure LoadTextFromFile(const FileName: string)
...................................................................................................................................... 34
function LoadImageFromFile(const FileName: string; w : Integer = 0;
h: Integer...................................................................................................................................... 34
= 0): Boolean;
© 2004-2008 WPCubed GmbH - Munich, Germany
- 3. Contents II
property DataCollection: TWP
...................................................................................................................................... 34
RTFDataCollection
property DataBlock: TWP
...................................................................................................................................... 35
RTFDataBlock
property MergeAttr: TWPStoredCharAttrInterface
...................................................................................................................................... 35
property MergeP TP
...................................................................................................................................... 35
ar: aragraph
property MergeP os: Integer
...................................................................................................................................... 35
arP
property Obj: TObject
...................................................................................................................................... 35
property CodeP ...................................................................................................................................... 35
age: Integer
property StringValue: AnsiString
...................................................................................................................................... 36
property WideStringValue: WideString
...................................................................................................................................... 36
property OldText: string
...................................................................................................................................... 36
property OldFormattedText: string
...................................................................................................................................... 36
property OldIsP...................................................................................................................................... 36
lain: Boolean
property CurrentObject: TWP
...................................................................................................................................... 36
Object
property CurrentTxtObject: TWP
...................................................................................................................................... 36
TextObj
property Options: TWP
...................................................................................................................................... 36
MailMergeContinueOptions
property Name: string
...................................................................................................................................... 37
property FieldnameP
...................................................................................................................................... 37
art: string
property DatasetnamePart: string
...................................................................................................................................... 37
property Command: string
...................................................................................................................................... 37
property StartInspObject: TWP
...................................................................................................................................... 37
TextObj
property E nspObject: TWP
...................................................................................................................................... 37
ndI TextObj
property DisplayName: string
...................................................................................................................................... 37
property Format: Integer
...................................................................................................................................... 37
property Modified: Boolean
...................................................................................................................................... 38
property Hyperlink: string
...................................................................................................................................... 38
property HyperlinkName: string
...................................................................................................................................... 38
property I...................................................................................................................................... 38
sNull: TWP nsertTextContentsNull
MMI
property ReplaceMode: TWP nsertTextContentsReplaceMode
...................................................................................................................................... 38
MMI
FieldLocate: Modify Field Name or Contents
.................................................................................................................................................. 38
Use TWP .................................................................................................................................................. 39
M DataP
M rovider
FastAppendText: Create text w ith multiple letters
......................................................................................................................................................... 39
E xample: FastAppendText
.................................................................................................................................................. 39
Create Sections w ith FastAppendText
.................................................................................................................................................. 40
Create Lists .................................................................................................................................................. 40
Save created text
.................................................................................................................................................. 40
Hide empty paragraphs
......................................................................................................................................................... 40
Forms/Edit Fields
......................................................................................................................................................... 41
Create ComboBox
......................................................................................................................................................... 43
6 Tasks
................................................................................................................................... 45
Mini Editor ......................................................................................................................................................... 45
Save to HTML / Load from HTML
.................................................................................................................................................. 47
How to use the "Default Editor"
......................................................................................................................................................... 47
Toolbar and Action Classes
......................................................................................................................................................... 49
Change Behaviour and Appearance of Editor
......................................................................................................................................................... 51
Layoutmodes .................................................................................................................................................. 51
Hover E .................................................................................................................................................. 54
ffects
EditOptions.................................................................................................................................................. 56
View Options .................................................................................................................................................. 58
Format Options.................................................................................................................................................. 59
HideTableBorders
.................................................................................................................................................. 61
Header and Footer
......................................................................................................................................................... 61
Create Sections
......................................................................................................................................................... 66
Full implementation - show s how to w ork w ith sections
.................................................................................................................................................. 67
Use utility .................................................................................................................................................. 69
procedure AppendAsSection
© 2004-2008 WPCubed GmbH - Munich, Germany
- 4. III WPTools Version 6
Use strings in WPTOOLS format w ith the <new section/> tag
.................................................................................................................................................. 69
Append section w ith individual footer (or header)
.................................................................................................................................................. 69
Use WPTools w ith TBX (Toolbar2000 Extension)
......................................................................................................................................................... 70
Set Attributes in code (unit WPCreateDemoText)
......................................................................................................................................................... 74
Tables ......................................................................................................................................................... 78
Set w idth .................................................................................................................................................. 79
in inch of a certain column
Work w ith.................................................................................................................................................. 81
% w idth
Create Table in Code
......................................................................................................................................................... 81
Work w ith Styles and Stylesheets (in code)
......................................................................................................................................................... 86
Numbering ......................................................................................................................................................... 93
Hyperlinks ......................................................................................................................................................... 96
Bookmarks ......................................................................................................................................................... 98
XML editor mode
......................................................................................................................................................... 100
Printing - how to set printer properties
......................................................................................................................................................... 103
Superprint: Print Booklets and Labels
......................................................................................................................................................... 104
Print Labels (TWPSuperPrint)
......................................................................................................................................................... 107
Print/Edit......................................................................................................................................................... 110
elements of TWPRTFDataCollection
Create Table from Database
......................................................................................................................................................... 112
Print Watermarks
......................................................................................................................................................... 115
Use "External Pages"
......................................................................................................................................................... 120
Images ......................................................................................................................................................... 123
Provide a Graphic Popup Menu
.................................................................................................................................................. 125
Linked I .................................................................................................................................................. 127
mages
Technical Information
.................................................................................................................................................. 127
TWPTextObj w ith custom draw event
......................................................................................................................................................... 128
Working ......................................................................................................................................................... 130
w ith multiple threads
Create Text Paths
......................................................................................................................................................... 131
Syntax Highlighting
......................................................................................................................................................... 133
TWP SynE ighlight
.................................................................................................................................................. 134
ditH
TWP CustomSyntax (added to WP
.................................................................................................................................................. 134
Tools 6)
TWP LSyntax
XM .................................................................................................................................................. 135
TWP LR
XM .................................................................................................................................................. 136
TFSyntax
TWP FieldSyntax
.................................................................................................................................................. 136
TWP FieldBandSyntax
.................................................................................................................................................. 136
Auto capitalisation
......................................................................................................................................................... 136
Search&Replace Text
......................................................................................................................................................... 137
CPChar, CPMoveNext, etc.
......................................................................................................................................................... 140
Share Styles betw een TWPRichText
......................................................................................................................................................... 141
Multiple Editors for the Same Text
......................................................................................................................................................... 142
Use TWP.................................................................................................................................................. 143
RTFStorage
Create Multi View in Code
.................................................................................................................................................. 144
Work w ith sub paragragraphs
......................................................................................................................................................... 144
7 BCB Notes
................................................................................................................................... 147
Example: Create dynamic TWPCustomRTFEdit
......................................................................................................................................................... 148
Example: Create image object and insert
......................................................................................................................................................... 149
8 Label Priniting
................................................................................................................................... 149
LabelDef......................................................................................................................................................... 149
Vertical .................................................................................................................................................. 151
UnitI nch.................................................................................................................................................. 151
sI
Top .................................................................................................................................................. 151
StartNr .................................................................................................................................................. 151
SheetWidth .................................................................................................................................................. 151
SheetHeight.................................................................................................................................................. 152
Row Count .................................................................................................................................................. 152
© 2004-2008 WPCubed GmbH - Munich, Germany
- 5. Contents IV
R ight .................................................................................................................................................. 152
P adding .................................................................................................................................................. 152
N e
am .................................................................................................................................................. 152
Lef t .................................................................................................................................................. 153
LabelWidth .................................................................................................................................................. 153
LabelHeight .................................................................................................................................................. 153
Horizontal .................................................................................................................................................. 153
Colum .................................................................................................................................................. 153
nCount
Caption .................................................................................................................................................. 153
Bottom .................................................................................................................................................. 154
AsText .................................................................................................................................................. 154
Active .................................................................................................................................................. 154
Example ......................................................................................................................................................... 154
Project
I
nitialization
.................................................................................................................................................. 155
After changing sheet size and margins
.................................................................................................................................................. 155
Change of column count or row count
.................................................................................................................................................. 156
Change of label w idth and height
.................................................................................................................................................. 156
ReadP .................................................................................................................................................. 156
rops and StoreP rops
9 HTTP Interface
................................................................................................................................... 157
Form Setup ......................................................................................................................................................... 158
Unit Initialization
......................................................................................................................................................... 159
User Action and History Management
......................................................................................................................................................... 160
Load Method......................................................................................................................................................... 160
Webbrow ser w ith WPTools
......................................................................................................................................................... 162
Source View......................................................................................................................................................... 162
10 MIME Import / Export
................................................................................................................................... 163
Reader / ......................................................................................................................................................... 164
Writer
Demo ......................................................................................................................................................... 164
11 PDF export with wPDF
................................................................................................................................... 165
Export to......................................................................................................................................................... 166
PDF
Export using dialog
......................................................................................................................................................... 167
Export using PaintRTFPage()
......................................................................................................................................................... 167
Create edit / memo fields
......................................................................................................................................................... 169
Create a ......................................................................................................................................................... 169
check box field
Create embedded data objects
......................................................................................................................................................... 170
12 Adding Spellcheck
................................................................................................................................... 171
Use WPSpell
......................................................................................................................................................... 172
13 WPReporter Addon
................................................................................................................................... 174
Comparison to "usual" reporting
......................................................................................................................................................... 175
Calculation in Text and Tables
......................................................................................................................................................... 176
Reporting w ith WPReporter
......................................................................................................................................................... 178
WPReporter - step by step
......................................................................................................................................................... 181
WPReporter Events
......................................................................................................................................................... 188
Convert text into template
......................................................................................................................................................... 190
Reporter......................................................................................................................................................... 192
and Bookmarks
Token to......................................................................................................................................................... 192
Template Conversion
General Syntax - Fields
.................................................................................................................................................. 193
Syntax Highlighting
.................................................................................................................................................. 194
Bands .................................................................................................................................................. 195
Groups .................................................................................................................................................. 195
Parameters for Fields
.................................................................................................................................................. 196
Parameters for Bands and Groups
.................................................................................................................................................. 197
© 2004-2008 WPCubed GmbH - Munich, Germany
- 6. V WPTools Version 6
Example Template
.................................................................................................................................................. 197
14 WPPremium Addon
................................................................................................................................... 199
Text boxes
......................................................................................................................................................... 200
Footnotes
......................................................................................................................................................... 201
Columns ......................................................................................................................................................... 201
15 Trouble Shooting
................................................................................................................................... 202
Part VIII Reference 202
1 Reader and Writer
................................................................................................................................... 203
2 TParagraph API
................................................................................................................................... 204
TParagraph Properties
......................................................................................................................................................... 204
TParagraph Methods
......................................................................................................................................................... 207
AppendParCopy
......................................................................................................................................................... 214
3 TWPRTFDataCursor
................................................................................................................................... 215
Drop-Markers
......................................................................................................................................................... 215
Attribute......................................................................................................................................................... 217
Interfaces
4 Manage Style Properties
................................................................................................................................... 223
List of 'A' methods
......................................................................................................................................................... 224
ASet/GetBorder
......................................................................................................................................................... 226
5 WPAT_codes
................................................................................................................................... 227
Character Attributes
......................................................................................................................................................... 227
Paragraph Attributes
......................................................................................................................................................... 229
Numbering Attributes
......................................................................................................................................................... 230
Border Attributes
......................................................................................................................................................... 231
Table Size and Position
......................................................................................................................................................... 233
Part IX Notes for Upgraders 234
1 Updated Rendering and Formatting
................................................................................................................................... 236
2 Changed Unit Names
................................................................................................................................... 236
3 Changed Classes
................................................................................................................................... 237
4 Changed Pointers
................................................................................................................................... 237
5 Changed GUI elements
................................................................................................................................... 238
6 New Border Handling
................................................................................................................................... 239
7 Changed Style Handling
................................................................................................................................... 240
8 BackgroundImage
................................................................................................................................... 240
Part X Release Notes - WPTools 6 240
Part XI Release Notes - WPTools 5 243
Index 261
© 2004-2008 WPCubed GmbH - Munich, Germany
- 7. What is WPTools? 1
1 What is WPTools?
WPTools is a word processing component for Borland Delphi and C++Builder. It loads
and saves RTF files. Its RTF implementation is one of the most complete on the
component market (header/footer, paragraph styles, optional footnote support, table
header rows).
The "premium" edition also does columns, text boxes and footnotes.
But it does not only serve to edit text, it is a powerful toolset for mass mailing and,
optional, RTF reports.
If you need a text component for Microsoft Access(TM), VisualFox PRO(TM), VisualBasic
(TM) or .NET please use our new word processing component TextDynamic. This
component has been esspecially created for .NET. It offers the same word porcessing
features as WPTools Version 6 does. The concept of the programming API is similar. The
.NET version does not use an OCX but an assembly written in C#, but an OCX is also
included at no extra charge.
Info: www.textdynamic.com
If you need word processing or text conversion features (RTF to PDF, HTML to PDF, RTF
to HTML) on a server (ASP) or with .NET or as ActiveX please check out our product
RTF2PDF / TextDynamic Server. It now includes the same powerful API as used by
TextDynamic.
The History
The first version of our product was released on the Delphi market in January 1996. Over
the years it has evolved further to become what you now see. First of all, HTML and
WYSIWYG support was added, later we also added the page layout view and fast
zooming. At the beginning of 2004 version 4.22 was released - it was the last release of a
WPTools version which was still partially based on the RTF Engine created in 1996.
During 2003 and 2004 the WPCubed GmbH, managed by Julian Ziersch, developed a
new word processing engine. This new engine was constructed to provide solutions for
the wide variety of demands which were raised over the last 8 years and addresses
issues which could not be solved within the framework of the old WPTools engine.
WPTools has been quite successful over the last 8 years and was used in a multitude of
projects, both large and small. It is the only text editor which was developed in native
Delphi and which supports WYSIWYG page layout view (with WYSIWYG header and
footer), including support for tab stops. The competition continues to struggle to achieve
the standard set by WPTools, thus demonstrating that the original concept was very
good. So why was this rewrite necessary?
In-depth modifications were required to add support for new features, such as nested
tables. Plus, potential .NET compliancy made it necessary to remove pointer aritmetic
completely. This had been very important in 1996 to enhance performace and because
the compiler did not support arrays with variable lengths. Furthermore, some parts of the
programming interface had become redundant over the years and last, but not least, CSS
and XML development brought new ideas to word processing, which could only be
implemented in a complete re-write.
WPTools 4 had heaps of functionality, but a great deal of it was developed in an ad-hoc
© 2004-2008 WPCubed GmbH - Munich, Germany
- 8. 2 WPTools Version 6
manner - a problem arose and we provided a solution. But the various solutions provided
did not necessarily gel consistently into an integrated framework and the planned
architecture of the engine.
In the end we decided it would be a good idea to take advantage of the opportunity to
develop a new RTF-Engine to fulfill the needs which had arisen within a structured
environment.
The new RTF-Engine was first used for WPTools 5. WPTools 6 is build upon the stable
WPTools 5 kernel, but introduces several interesting new features. We also optimized the
engine to improve load and save times. WPTools 5 is still serviced but new features will
go exclusively into WPTools 6. The migration from WPTools 5 to WPTools 6 is made as
easy as possible.
What does WPTools Version 6 do?
a) Word processing (WYSIWYG, page layout view, headers + footers, tab stops,
paragraph styles, UNICODE).
b) Special text editing tasks - most importantly, editing one text stream with multiple
editors which can be on different forms.
c) Reporting - WPTools has the ability to dynamically create and display text during
page formatting. This makes it possible to display calculated sums in dynamic table
footers. Because the display changes after each reformat, this is an ideal solution for
creating invoices since the report is completely editable!
d) Preview - The developer can insert pages from any source (owner drawn) into the
displayed pages. This way it is possible to mix these pages with RTF pages and
preview and print them all at once. It is also possible to have an editable text, followed
by a report created by the specialized reporting engine and preview everything in the
same editor!
e) Spread sheet - WPTools has incredibly powerful and fast table support. It is fast
enough to hold thousands of rows!
f) Mail merge - It is possible to merge in text, plain or formatted and also images.
g) HTML editing - WPTools supports additive paragraph attributes which makes it
perfect for this task. In contrast to other solutions which completely import or export
the HTML properties, the form of the imported HTML text remains intact.
h) Automatic text creation. The new TableAdd function is very easy to use but still very
powerful. As we prove in our "ThreadSave" demo the text creation can take place in
sub threads.
i) new: Integrated Label printing.
j) new: Alternative formatting routine to display web pages.
k) new: MIME support (based on Synapse).
l) new: integrated HTML and XML syntax highlighting.
m) new: automatic HTTP download (based on Synapse)
n) new: PREMIUM version only: Application Server Mode
o) new: better Clipboard control and security
p) improved section support
q) other additions to API and various code optimation.
r) Optimized GUI - it is possible to use a marquee effect in the window
© 2004-2008 WPCubed GmbH - Munich, Germany
- 9. WPTools 6 new features 3
2 WPTools 6 new features
WPTools 6 includes many improvements to the editor and general working experience. It has an
enhanced API.
But it is also compatible to WPTools 5 and we tried to make the upgrade as smooth as possible.
This are the most notable new features:
1) Application-Server-Mode
WPTools 6 introduces a feature which is called "Application-Server-Mode". This is only available
when you have the PREMIUM version. This mode is activated when true is assigned to the global
boolean variable WPAppServerMode. When this mode is activated the editor does not use the
double buffered output anymore. While this can cause some flickering the network traffic is reduced
when the application runs on an application server, such as Citrix.
Please note, effective with WPTools 6 software which was written for application servers
(such as clinic software) may only be distributed when a TEAM or SITE license of WPTools
was acquired.
2) Integrated Label Printing
When activated the integrated label printing shows multiple labels on one virtual sheet of paper. The
cursor can move from label to label freely. The user can so edit the labels, add new or delete
unwanted labels before the complete sheet is printed. This is a very unique and versatile feature.
3) Additions to the PDF export with wPDF V3
Create embedded data objects
Create edit / memo fields
Create a check box field
Also the creation of PDF tags was enhanced. So now hints to paragraph styles will be also
exported.
4) Additional Control over Clipboard Actions
a) properties to select the format
b) added security
5) Added section API
+ WPRichText1.ActiveSection
+ WPRichText1.InputSection
+ TWPPagePropDlg has new method ExecuteEx. Use it to change current page size or Section
WPPagePropDlg1.ExecuteEx(WPRichText1.ActiveSection);
6) Load over HTTP connections (requires Synapse)
7) Load and save MIME encoded HTML with embedded images (requires Synapse)
8) Integrated XML syntax highlighting
9) WPReporter: Token to Template conversion with syntax highlighting
10) Scroll with middle mouse button
© 2004-2008 WPCubed GmbH - Munich, Germany
- 10. 4 WPTools Version 6
11) Premium Edition: Now Column Balancing is now supported
12) draw gradient effect in background of editor
13) XML editor mode
here w e use a style sheet to auto format the embedded texts, in this case the style sheet
Lemma{font-family:'Courier New';font-weight:bold;color:red}
Entsprechung{font-family:'Tahoma';font-size:13.00pt;}
14) new Insert Symbol Dialog
© 2004-2008 WPCubed GmbH - Munich, Germany
- 11. WPTools Version 6 5
3 WPTools Version 6
WPTools Version 6 has an entirely new RTF Engine, compared to WPTools 1 to 4. This
makes it much easier to work with the paragraph text and offers an object-oriented
approach whenever such an approach is beneficial.
Please read chapter "Release notes", "Data Structures" and "Quick Start".
The new data model supports a separation between data and editing logic. This makes it
possible to attach multiple editors to one text object in order to view different parts of the
same text. This feature can be used to create a split view of the same text or, even more
interesting, to link different editors to specific pages. This feature can also be used to edit
text paths in DTP applications.
The result is a suite of components with a combination of features you will not find
available in any other single component package.
New concepts found in WPTools Version 6 include:
· storage of character attributes in a special record which is assigned to the character
which uses these particular attributes. This makes it easy to copy characters and
assign new attributes. Other products use start and end tags to store character
attributes with the danger of inconsistency if a tag 'gets lost'. Since WPTools caches
the attributes, it does not consume a lot memory for them!
· paragraph storage in a linked list with sub-elements (children) - this reflects the
document structure of HTML and makes it possible to support HTML/CSS editing.
· inherited attributes - in WPTools paragraph and character attributes can be added and
removed. If an attribute is not defined the 'default' or 'inherited' value is used instead.
For application designers WPTools Version 6 supports
· different types of multiple page layout which can be displayed quickly
· fast zooming
· the possibility of editing ONE text in TWO (or more) windows (split-screen)
· effective property dialogs (NEW: The dialogs shade 'undefined' values)
· integrated localization
· and all important action classes are included.
For word processing WPTools Version 6 includes
· a vast number of paragraph and character attributes for text (numbering, alignment,
indents, spacing - the usual RTF features, but also color and style for various
underlines, different border styles, background colors)
· strong table support - including the ability to nest tables (table within a table) and
merging of table columns and table rows, with support for page breaks within table rows
· Repeated table header and footer rows
· pictures with text flow on one or (new!) both sides
· powerful support for headers and footers
· extensive support for paragraph styles
· improved support for tab stops - including support for leading signs (.......1.00).
· insertion of foreign pages - i.e. pages which are painted by an owner-provided function.
These pages appear in the text, but cannot be accessed with the cursor
· WYSIWYG
· and different layout modes - so powerful that the preview dialog now uses a standard
© 2004-2008 WPCubed GmbH - Munich, Germany
- 12. 6 WPTools Version 6
editor which is switched to read only. It still allows thumbnails and side-by-side page
layout views!
· Support for "sections" - have different page sizes in one document.
· new in V6: Clickable Section marker and dialog
For HTML/CSS editing WPTools Version 6 enables
· loading of HTML/CSS files
· saving of HTML/CSS files
· and powerful CSS support - the word processing engine supports inherited attributes
and nested tables and paragraphs.
· new in V6: Alternative formatting routine to display web pages.
· new in V6: Ready to use unit to load over HTTP connection (based on Synapse)
· new in V6: MIME support to read *.MSG / *.EML / *.MHT (based on Synapse).
· new in V6: Integrated HTML and XML syntax highlighting.
For developers WPTools Version 6 is an improvement because it
· is not bloatware - in fact WPTools V5 is smaller than WPTools 4!
· offers effective memory management. It also supports many more paragraph and
character attributes without consuming more memory than the previous version (under
the same OS).
· is safe for multi-threaded applications
· allows the addition of new paragraph attributes
· makes it possible to insert 'external' or 'owner drawn' pages into a document
· offers support of most RTF features in HTML/CSS file format and vice versa. (Notable
exception: Tab stops cannot be coded into HTML/CSS.)
· makes it possible to share styles and other properties (color palette, font table) between
texts. This makes it easier to work with two synchronized RTF texts.
· allows linking of editors to text paths (the text is never copied between these editors).
· provides support for Delphi 5, 6, 7 and 2005(Win32), 2006, 2007
· provides support for C++Builder 5 and 6, C++Builder 2006
· provides an effective storage format which produces the minimum amount of RTF and
HTML/CSS code possible.
· optionally: Support for FastReport 3 & 4 (supports stretching)
· optionally: Support for ReportBuilder 9 & 10 (supports stretching)
· optionally: Support for QuickReport 4
Optional in WPTools PREMIUM:
· editing and printing of footnotes (WYSIWYG!)
· text boxes (movable boxes with RTF text. Anchor is in text body)
· support for columns (newspaper layout).
· Application Server Mode - this mode activates text rendering which does not utilize a
double buffer. This makes it possible to minimize the network traffic.
Other products in WPTools family:
· WPSpell - spell checking highly integrated into the WPTools environment
· wPDF - perfect and fast PDF creation, not only from WPTools since it also does
conversion of metafiles. Supports PDF/A.
· WPViewPDF - display and print the PDF files not only created by wPDF but also
several competing products.
© 2004-2008 WPCubed GmbH - Munich, Germany
- 13. WPTools Version 6 7
We hope that you are as satisfied with WPTools Version 6 as we are and that the
improvement in your product is worth the effort which may be required for the upgrade to
this new version. WPTools Version 6 was built to be the most powerful word processor
available on the component market. In addition, it also works as a HTML editor, offering
convenient word processing features, while still working as closely to the HTML document
model as possible.
4 License
1. NO ROYALTIES F EXE-PROJECTS
OR
IF YOU ARE REGISTERED YOU HAVE THE RIGHT TO DISTRIBUTE PROGRAMS (EXE-FILES) YOU HAVE
CREATED WITH THE HELP OF WORD PROCESSING TOOLS ROYALTY-FREE. YOU MAY NOT
DISTRIBUTE MODULES WHICH MAY BE USED BY OTHER (ALSO NOT "INHOUSE") DEVELOPERS
(SUCH AS COMMANDLINE TOOLS, VBX, OCX, VCL, DLL, VCL OR ACTIVE-X) WITHOUT WRITTEN
PERMISSION. THE LICENSE DOES NOT INCLUDE THE PRODUCTION OF ACTIVE-X MODULES FOR
THE USE WITHIN THE INTERNET.
THE SOFTWARE SUPPLIED MAY BE USED BY ONE PERSON ON AS MANY COMPUTER SYSTEMS AS
THAT PERSON USES.
GROUP PROGRAMMING PROJECTS MAKING USE OF THIS SOFTWARE MUST PURCHASE A COPY OF
THE SOFTWARE FOR EACH MEMBER OF THE GROUP. THIS DOES *ALSO* APPLY WHEN "ONLY ONE"
PERSON IN THE GROUP IS DEVELOPING WITH WPTOOLS!
CONTACT JULIAN ZIERSCH FOR VOLUME DISCOUNTS AND SITE LICENSING AGREEMENTS.
Note: the distribution license requires:
If WPTools is used in a project which is developed by a group of developers, all members
of this group must have a WPTools development license!
In case only one developer works with WPTools but there are others in the project who
work with other development systems, those other developers still need a WPTools license
since the work of the first developer is a "Module" for the others.
Please note, effective with WPTools 6 software which was written for application servers
(such as clinic software) may only be distributed when a TEAM or SITE license of WPTools
was acquired.
If this condition is not met, the product may not be distributed. If developers join the
project, new licenses are required. This license model makes it possible for us to provide
and support a product as powerful and versatile as WPTools.
2. THE LICENSE DOES NOT ALLOW PRODUCTION OF MODULES, DLLS, ActiveX OR COMMAND LINE
UTILITIES
UPON REGISTRATION OF THE STANDARD VERSION YOU WILL RECEIVE 70% OF THE SOURCE FILES
FOR VERSION 5.x. YOU MAY ALTER THEM BUT YOU MAY NOT DISTRIBUTE THEM TO ANY OTHER
PERSON WHO HAS NOT REGISTERED! YOU MAY NOT DISTRIBUTE WPTOOLS-DCU FILES OR DELPHI/
BCB DESIGNING PACKAGES EITHER. IT IS NOT ALLOWED TO USE WPTOOLS IN COMMAND LINE
UTILITIES, SUCH AS TOOLS WHICH DESIGNED TO ONLY RENDER RTF OR HTML - EXCEPT FOR
INHOUSE USE. THE USE IN A GENERAL "VIEWER" APPLICATION WOULD BE AGAINST THIS LICENSE.
© 2004-2008 WPCubed GmbH - Munich, Germany
- 14. 8 WPTools Version 6
IF YOU NEED THE COMPLETE SOURCE PLEASE PURCHASE THE PRO OR PREMIUM VERSION!
3. NO REVERSEENGINEERING
YOU MAY NOT REVERSE ENGINEER, DECOMPILE, OR DISASSEMBLE THE PRODUCT UNLESS
ALLOWED BY APPLICABLE LAW. THE PROVISION OF SOURCE CODE DOES NOT CONSTITUTE A
TRANSFER OF ANY LEGAL RIGHTS TO SUCH CODE, AND RESALE OR DISTRIBUTION OF ALL OR ANY
PORTION OF ALL SOURCE CODE AND INTELLECTUAL PROPERTY WILL BE PROSECUTED.
THIS COMPONENT IS LICENSED FOR USE WITH DELPHI OR C++BUILDER WIN32 ONLY - THE
SOURCE MAY NOT BE ALTERED TO BUILD .NET TOOLS OR TOOLS FOR OTHER COMPILERS OR
OPERATION SYSTEMS.
THE WPTOOLS STANDARD AND STANDARD-PRO VERSION DOES NOT INCLUDE THE RIGHT TO
EXTEND IT TO SUPPORT COLUMNS, TEXTBOXES OR THE PRINTING OF FOOTNOTES. THIS IS
RESERVED TO THE "PREMIUM" EDITION. THE SAME IS TRUE FOR TEXT BOXES BASED ON OUR
LAYER TECHNOLOGY.
THE DISTRIBUTION LICENSE FOR CREATED APPLICATION(S) REQUIRE THIS LICENSE AGREEMENT
TO BE RESPECTED!
4. YOU MAY NOT RENT, LEASE, OR LEND THIS SOFTWARE COMPONENT.
ONCE AN APPLICATION WHICH USES THIS LIBRARY WAS DISTRIBUTED, THE LICENSE MUST STAY
WITH THE COMPANY WHICH HOLDS THE DISTRIBUTION RIGHT TO THE DISTRIBUTED APPLICATION.
5. LIABILITY LIMITATION
THE DOCUMENTATION AND THE VCL ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND/OR SUITABILITY FOR A PARTICULAR PURPOSE. THE USER ASSUMES THE
ENTIRE RISK OF ANY DAMAGE CAUSED BY THIS SOFTWARE.
THIS INCLUDES DAMAGE BECAUSE OF INFRINGEMENT OF ANY PATENTS.
IN NO EVENT SHALL JULIAN ZIERSCH OR WPCUBED GMBH BE LIABLE FOR DAMAGE OF ANY KIND,
LOSS OF DATA, LOSS OF PROFITS, INTERRUPTION OF BUSINESS OR OTHER PECUNIARY LOSSES
ARISING DIRECTLY OR INDIRECTLY FROM THE USE OF THE PROGRAM. ANY LIABILITY OF THE
SELLER WILL BE EXCLUSIVELY LIMITED TO REPLACEMENT OF THE PRODUCT OR REFUND OF
PURCHASE PRICE.
GOOD DATA PROCESSING PROCEDURE DICTATES THAT ALL PROGRAMS BE THOROUGHLY TESTED
WITH NON CRITICAL DATA BEFORE THEY CAN BE RELIED UPON.
4. COPYRIGHT MESSAGEREQUIRED
IF YOUR PROGRAM HAS AN "ABOUT BOX" THE FOLLWING CREDIT SHOULD BE DISPLAYED IN IT:
"WPTools (C) Julian Ziersch" or "WPTools (C) WPCubed GmbH"
5 Technical Notes
WPTools Version 6 supports Delphi 5,6,7 and 2005, 2006 (Win 32) and Delphi 2007. It
also supports Borland C++ Builder 5 and 6 and C++Builder 2006.
Delphi 3 and 4 are not supported since the code requires modern language features,
such as method overloading.
© 2004-2008 WPCubed GmbH - Munich, Germany
- 15. Technical Notes 9
If you need a text component for Microsoft Access(TM), VisualFox PRO(TM),
VisualBasic(TM) or .NET please use our new word processing component
TextDynamic. Info: www.textdynamic.com.
For ASP and ASP.NET we have RTF2PDF / TextDynamic Server. This
component includes most of the prowerful interface methods TextDynamic has.
Please check out our demo webserver at http://www.rtf-net.com/
The code uses pointers only in very few functions - mainly to optimize the performance.
The reader and writer classes do not use static buffers.
The use of global variables has been limited. The most important ones are stored in the
TWPToolsEnviroment object. By creating several instances of this class it is possible to
create a threadsave application. (See demo ThreadSave)
WPTools Version 6 has been designed for modern PCs.
The Text rendering engine requires an up-to-date graphics adapter. We recommend a
CPU with at least 500Mhz.
The Memory consumption has been highly optimized. It is equal or less than with
WPTools 4.
The general text editing functionality require Windows 98 or later. Unicode support was
tested with XP only - special word wrap rules for unicode text have not been implemented,
such as Japanese rules. Support for RTL languages is limited (experimental).
For questions about WPTools Version 6 please use our web based forum:
Discussion
FAQ: Questions when upgrading
FAQ: General
You will find the Release notes at the end of this manual.
6 PDF Products
WPCubed GmbH also markets this PDF products:
wPDF:
Powerful and versatile PDF creator for Delphi and C++Builder.
It supports WPTools (see "PDF export with wPDF") and the most important
Delphi reporting engines. Also converts metafiles into PDF data.
New Features in wPDF Version 3
· Support for standard brush styles (hatching)
· TransparentBitBlt
· Automatic reuse of the same image data. This way, when you export a
document which often uses a logo the PDF file will be significantly smaller!
· Creation of PDF/A complient PDF files (with added meta data and PDF
© 2004-2008 WPCubed GmbH - Munich, Germany
- 16. 10 WPTools Version 6
tagging when you use it with WPTools)
· Support of CID fonts (known as "unicode" support)
· Binary Data embedding: You can store the document source which was
used to create a PDF file within this PDF file. When you use WPTools for the
PDF creation you can store the RTF source document inside of the created
PDF data, the user only has to click on an icon to extract this document.
This can be a great feature if you use it to embed programming examples
within your programming manual!
WPViewPDF:
To view, print and manipulate PDF files right in your Application our product
WPViewPDF Version 2 may be interesting for you. It is not only usable with .
NET and as ActiveX, but also in Delphi and C++Builder.
This component was created to view PDF files which were created using the
wPDF engine, but it is also capable of viewing PDF files created with other
windows based engines which utilize TrueType(tm) fonts. In contrast to many
competing solutions WPViewPDF is very fast. You can also use WPViewPDF to
convert PDF to EMF and to convert PDF to JPEG.
New Features in WPViewPDF
Version 2
· now with bookmark tree
· now text selection and copy to
clipboard is supported
· auto scrolling (use middle mouse
key).
· Optionally high quality font
rendering of embedded Type1
and TTF subset fonts
WPViewPDF PLUS:
With the PLUS license you can save the PDF information from WPViewPDF
which makes it a versatile pdf conversion software. This means you can load
in multiple PDF files and save all pages into a new PDF file (=pdf merge, edit
pdf).
Certain pages can be marked to be deleted, they will not be displayed by
WPViewPDF. When you save the PDF file this pages will be removed. It is also
possible to set new security properties (apply, remove encryption) and set
property strings int this pdf conversion tool. The WPViewPDF Demo has the
PLUS features enabled, but when a new file is created a red cube will be
printed on all pages.
With the "PLUS" version it is possible to add text and vector graphics to
certain pages of a PDF file (pdf stamping). Any text will be converted to
vectors - this allows it to use special fonts. The graphics will be already visible
in the viewer before the PDF data has been updated!
© 2004-2008 WPCubed GmbH - Munich, Germany
- 17. PDF Products 11
NEW: it is also possible to read and modify Acro Form field in PDF files!
WPViewPDF: merge, split, stamp, encrypt, decrypt PDF files!
7 Guide
In this chapter we collected introduction texts to important tasks which can be solved with WPTools.
We recommend to also review the HLP file since it contains a structured list of all classes,
properties and methods. It also contains 'Categories' which are a big help. In chapter 'Tasks' we
will explain how to create the first small editor, how to use mail merge, how attach a
generic toolbar using actions and much more. There is also an introduction to WPReporter
.
Please check out the demos which are described in this chapter:
Mini Editor - shows how to create a small, yet powerful editor
Create Table in Code - demos the most effective way to create tables in code
TBX Demo - how to use WPTools with TBX, the toolbar 2000 extension
GridMode - how to create tables dynamically from a database
DynAssign TWPRTFDataCollection (create MDI app without MDI windows)
ParStyle - this demo shows how to work with the CSS like paragraph styles
Localization - how to localize (translate) the dialogs and messages.
Also see the Programming Overview .
QuickStart
© 2004-2008 WPCubed GmbH - Munich, Germany
- 18. 12 WPTools Version 6
After having dropped the TWPRichText you can click right to use the QuickConfig dialog:
[the WPTools Propery Dialog]
© 2004-2008 WPCubed GmbH - Munich, Germany
- 19. Guide 13
© 2004-2008 WPCubed GmbH - Munich, Germany
- 20. 14 WPTools Version 6
Loading and Saving
To load text into the editor You can use the functions LoadFromFile, LoadFromStream and also the
properties AsString and SelectionAsString (the latter inserts the text). To move the cursor before the
insertion or after the load modify the property CPPosition.
To save the text You can use the functions SaveToFile, SaveToStream and AsANSIString. The
function AsANSIString is useful to convert the text into a data string of a given format, i.e.
AsANSIString('HTML') will create a string with HTML tags.
If the load and save functions ask for a second string parameter this is a "format string" - please read
more here http://www.wpcubed.com/manuals/formatstrings.htm
In our web based forum we have posted several FAQ topics and articles.
The article "Compose an e-mail in HTML format / Save image to HTML" shows how to create a
HTML e-mail.
The WPRichText component implements several functions which open a dialog box: Load, Save,
SaveAs, InsertGraphicDialog and Insert.
7.1 Localization - change Language in Dialogs
For anyone wanting to work with inch units, please add the following line in your code (for example,
in the FormCreate event).
GlobalValueUnit := euInch;
WPTools Version 6 supports the localization of the texts which are used for filters and error
messages and also the localization of the provided property dialogs.
Steps to update the dialog language in WPTools 5 and 6:
We start with a simple form:
Now w e add the component TWPLanguageControl to the form
© 2004-2008 WPCubed GmbH - Munich, Germany
- 21. Guide 15
A double click opens the XML editor.
Here we can load (and merge in) the language files which are provided under DemosTasks
Localization. Close the form with File/OK
Please note that the properties Active, AutoLOadString and AutoSaveStrings are not
supported in WPTools 5 or WPTools 6.
Here we need to create a COM interface like this:
Add the units WPUtil and WPActnStr to the uses clause.
To active use this code in the OnCreate event of the form:
procedure TForm1.FormCreate(Sender: TObject);
begin
WPLangInterface := TWPLocalizationInterface.Create(WPLanguageControl1);
WPLanguageControl1.GlobalLanguage := 'DE';
WPLocalizeLoadForms := TRUE;
WPTools_LoadVCLStrings;
WPTools_LoadActionStrings;
end;
© 2004-2008 WPCubed GmbH - Munich, Germany
- 22. 16 WPTools Version 6
In the OnDestroy event add this:
procedure TForm1.FormDestroy(Sender: TObject);
begin
WPLangInterface.Free;
end;
Done: We have hints in German:
And Dialogs, too:
To change the language at runtime use code like this:
WPLanguageControl1.GlobalLanguage := 'DE';
WPLocalizeLoadForms := TRUE;
© 2004-2008 WPCubed GmbH - Munich, Germany
- 23. Guide 17
WPTools_LoadVCLStrings; // from unit WPUtil
WPTools_LoadActionStrings; // from unit WPActnStr
You need to create the TWPLanguageControl and the Interface
on the Form which is created first in the project.
If necessary You can put it into a Datamoduel.
How does the localization work?
In WPTools Version 6 we are using a localization interface which is defined as:
IWPLocalizationInterface = interface
['{A12EF1F7-E592-4483-855F-67E28332AFC5}' ]
// This method can be used to save the menu items and captions
on a certain form. I f you use the TWPLocalizeForm class you don't need
to care about that. }
procedure SaveForm(
const Name: string;
Form: TWinControl;
Menus, Captions, Hints: Boolean);
// Load all Components on a certain TForm. }
procedure LoadForm(
const Name: string;
Form: TWinControl;
Menus, Captions, Hints: Boolean);
// This method saves a string list under a certain name. The string list has to
use
the syntax NAME=xxxn }
procedure SaveStrings(
const Name: string;
Entries: TStrings;
Charset: Integer);
// Loads back the string(s) saved with WPLangSaveStrings }
function LoadStrings(
const Name: string;
Entries: TStrings;
var Charset: Integer): Boolean;
// Method to save a certain string. To save multiple strings use
WPLangSaveStrings
procedure SaveString(
const Name, Text: string;
Charset: Integer);
// Loads back a string saved with WPLangSaveString
function LoadString(
const Name: string;
var Text: string;
var Charset: Integer): Boolean;
end;
This interface is implemented by the TWPLanguageControl. The TWPLocalizeForm (implemented in
unit WPUtil, it is the anchestor of all localizable dialogs) automatically uses this interface through
the instance of the TWPLocalizationInterface class which must be created by your code:
WPLangInterface := TWPLocalizationInterface.Create(WPLanguageControl1);
© 2004-2008 WPCubed GmbH - Munich, Germany
- 24. 18 WPTools Version 6
7.2 Programming Overview/QuickStart
This topic should help you to find the correct procedures and properties in the reference manual
when you start programming with WPTools. Please note that the reference defines categories.
When you found one property you can browse the list of topics in the same category (link to list of
all categories).
Also see:
Mini Editor Hyperlinks
Save to HTML / Load from HTML Hover Effects
Localization/Translation Bookmarks
Mailmerge and forms Printing - how to set printer properties
Create Field Superprint: Print Booklets and Labels
Merge: Change Field Text/Read Field Text Print Labels (TWPSuperPrint)
Merge: Insert/Modify Image Print/Edit elements of TWPRTFDataCollection
Modify Field Name or Contents Create Table from Database
Create text with multiple letters Print Watermarks
Hide empty paragraphs Use "External Pages"
Forms/Edit Fields Images
Create ComboBox Provide a Graphic Popup Menu
How to use the "Default Editor" Linked Images
Toolbar and Action Classes Technical Information
Localization TWPTextObj with custom draw event
Layoutmodes Working with multiple threads
Header and Footer Create Text Paths
Create Sections Syntax Highlighting
Use WPTools5 with TBX (Toolbar2000 Extension) Search&Replace Text
Set Attributes in code (unit WPCreateDemoText) CPChar, CPMoveNext, etc.
Tables PDF export with wPDF
Set width in inch of a certain column Multiple Editors for the Same Text
Work with % width Use TWPRTFStorage
Create Table in Code Create Multi View in Code
Work with Styles and Stylesheets (in code) Work with sub paragragraphs
Numbering
7.2.1 Modify the look and feel of the editor
Please use the properties ViewOptions, EditOptions and EditOptionsEx.
The properties FormatOptions and FormatIOptionsEx change how the formatting routine works, they
have a significant influence on how the text appears.
Please also see the Layout Catagory.
To change the language (for localization, translation) please see demo "Lozalisation".
© 2004-2008 WPCubed GmbH - Munich, Germany
- 25. Guide 19
7.2.2 Change current writing mode
See property WPRichText.CurrAttr, here you can set attributes such as Bold, Italic etc. using
AddStyle and DeleteStyle. CurrAttr also controls the paragraph attributes (Alignment) indents and
spacing. CurrAttr will change the current writing mode or the selected text - if text is selected. See
this FAQ if you want to implement ShortCuts, such a Ctr+B = bold. WPTools Version 6 also has
more specialized attribute interfaces. They can be used to only change the current attribute, only the
selected text, the attributes of the text which was found by "Finder" or the attributes of merged text.
(Attribute Interface Category)
7.2.3 Move the Cursor
Please use the CP.. properties. CPPosition is the current character position, assign 0 to go to the
start, MaxInt to go to the end. Also procedure MovePosition is very useful. When the user changes
the cursor position the event OnChangeCursorPos is triggered.
7.2.4 Change Page Size and Page margins
Modify WPRichText.Header. The properties with "default" in their name are the values which will be
applied by Clear, the others are the current values. Method SetPageWH can be used to set several
values at once, the values which should not be changed can be passed as -1
7.2.5 Insert Text
Use the method InputString() to insert text at cursor position. The char codes #13 will create a new
paragraph, #12 a new page. To create a table use TableAdd (). Also see the chapter Set Attributes In
Code.
7.2.6 Mail Merge (replace fields with data)
This is done by once procedure, MergeText and the event OnMailMergeGetText. If you have a text
with fields marked with special characters (<name>) use method ReplaceTokens. Otherwise crate
fields with method InputMergeField . Note, that mail merge fields are embedded into two instances of
the TWPTextObj class. This FAQ shows how to work with images. Note: If you need to print (or
export to PDF) the text right after the merge process you need to call ReformatAll(false, true)!
7.2.7 Input TextObjects (i.e. page numbers)
This objects can be create with InputTextField(type) and InputTextFieldName(name). All text objects
can show custom text which is define by event OnTextObjectGetTextEx. Custom text objects will
usually display the text assigned to their property Params.
7.2.8 Create an own toolbar
If you decide to not use the toolbar we provide please open unit WPCtrRich.PAS and check out
method OnToolBarIconSelection. This method is executed for all toolbar button clicks and WPTools
actions. You can see how things are done. You can also call this method from "outside".
7.2.9 Save and load HTML
HTML is autotected when using the LoadFromFile or LoadFromStream methods. Images must be
directly linked to local files. Otherwise the image must be loaded in the event OnRequestHTTPImage
. (This event is also execoted for images in RTF files which have not been embedded but just linked.)
Also see this FAQ and the info about format strings.
© 2004-2008 WPCubed GmbH - Munich, Germany
- 26. 20 WPTools Version 6
7.2.10 Get and set the text "as string"
Use the property AsString - you can use SelectionAsString to read only the selected text. You can
also assign text - the property SelectionAsString will insert the text at the cursor position. The
function AsANSIString will work like property AsString but you can specify the format string,
optionally only save the selection. Also see the load & save category.
7.3 Data Structures
Here is a general description of the architecture and concept of the RTF engine, for your reference.
Please read this carefully! This knowledge is necessary for you to understand WPTools
Version 6.
Note: the separation between edit/display and data-objects make some elegant solutions
possible - ie. create MDI editor without using MDI windows! (See demo DynAssign )
Since not all details are listed here, please look for further information on the classes written in bold
in the online help (reference).
In the WPTools RTF-Engine (we always refer to the 'RTF-Engine', however this does not mean that
the engine is limited to the Rich-Text, *.RTF), a text is split up into several parts. The main parts are
stored in two objects which are linked together:
a) RTF Data is stored in the TWPRTFDataCollection(see: Multiple Editors for the Same Text)
b) RTF properties, such as paragraph or number styles, are stored in the TWPRTFProps object.
(see: Share Styles between TWPRichText)
© 2004-2008 WPCubed GmbH - Munich, Germany
- 27. Guide 21
Note: This concept allows multiple TWPRTFDataCollection objects to share the same
TWPRTFProps object. Thus, they share the same attribute identifier (such as index values for
colors). If you use this feature you can simply copy texts parts between RTFData objects or
compare text.
The TWPRTFDataCollectionalso hosts the text cursor (TWPRTFDataCursor) and a few
parameters which are shared by the RTF editors (TWPRTFDataCollectionEngineParams). This
means that even if you have several editors using one TWPRTFDataCollection there is only one
cursor which is the same for all editors attached. The cursor object also controls text selection and
changing properties of the selected text (SelectedTextAttr : TWPSelectedTextAttrInterface or the)
© 2004-2008 WPCubed GmbH - Munich, Germany