Creating a document with WinWord to use with Oleander is easy. Beside the usual text processing you will only have to deal with bookmarks (this refers to WinWord bookmarks and should not be confused with Delphi bookmarks). A bookmark specifies a distinct position or range of text in the document. This bookmark can be named and used with various methods. Oleander uses bookmarks to find and then replace text at a position you defined while creating the bookmark.
So you can design the document the way you like and then position the bookmarks at the places you want the text to appear. There are some considerations you will need to know to create a proper Oleander document, though.
Note: Word shows bookmarks in square brackets. If you do not see the brackets you have to tell Word to show them. Check the "Bookmarks" checkbox in the view tab of the TOOLS-OPTIONS menu.
Notice the bookmarks in square brackets in the screenshot below. The yellow rectangle shows a normal bookmark which will be replaced by the species name of the fish. The yellow circles mark the beginning and the end of the main group.
Although you can have text in the bookmark range, the content, this text is not used by Oleander to identify the bookmark. It is only the name of the bookmark that specifies the exact position. Most of the time you will enter text in the content, though, to make clear what will be printed when Oleander processes the document. The text you enter in the bookmark content will be replaced during print. Additional formating information can be placed in the content, too. Refer to the formatting section to get more information.
The names you give the bookmarks are predefined by the way the Oleander component is set up by the application. As Oleander has to find the proper bookmark for a given field to replace, it has to know the name of the bookmark to look for. Bookmarks unknown to Oleander can lead to printing problems. You should have a list of available bookmark names to reference them properly.
You must define at least one group in your document to identify the main looping group. A group is a bookmark, too, but one that does not refer to a specific field but spans over several other bookmarks which belong to same data context. Oleander will print the group contents as long as there is data available to this group. If you do not define the main group, Oleander will complain. In the most simple case the main group spans the whole document. The screenshot below shows the selected main group. Notice the brackets at the beginning and at the end.
This is all you have to know. You can use all Word features you like to enhance your documents. Insert graphics, use header and footer. Oleander will print with tables and formatted bookmark contents.
Refer to the Use TTable/TQuery with Oleander and the Tips & Tricks and known problems section for further information and some quirks and bugs in WinWord. Take a look at the Oleander demo application documents to learn how to create your own documents.