WPCubed GmbH
Wordprocessing and PDF components 

TableProducer - dynamic table in WPTools 9

Do you need to present the user the result of a database query and also print it? With WPTools' dynamic tables feature (included with WPTools Bundle and WPTools Premium) the user can not only browse the result of the query, but also change the appearance of the table and the data cells and print it in WYSIWYG manner.

Our word processing demo also includes a demo for this feature. You can select a SQLLight database file and select a table for printing.

In contrast to "data-grid" solutions, it is also possible to copy part of the created tables and paste them directly into a word processor program, such as MS Word or, of course, TWPRichText.

This is a new tool we are really excited about. It is consequently based on the powerful RTF-Engine classes of WPTools so it will not add a lot of "bloat" to your application since it reuses features which are in WPTools anyways. For example styles. With the new dynamic tables you can set up a style for each column - that style is stored as a string which is encoded in a readable format (WPCSS - our format to save styles also in WPTOOLS format).

Please note: The License for this tool does not include the production of software which is designed to attach to "general" databases which can be used for any tasks - this means it may not be used in a universal database application or reporting tool.

In this video we show how to display the contents of a database in a TWPRichText - at designtime

[embed] https://www.wpcubed.com/videos/tableproducer.mp4[/embed]

Live table can be created using the API AddDynamicGrid and GridUpdate - but the best option is to use the new TWPTableProducer and TWPTableProducerDB component. This "Producer" components contain collections of "Blocks" which each can contain some formatted text and the description of columns to build one or more table rows. Using link properties "ClientName" and "NextName" a chain can be built to display relational data.

Above is a rather simple example for an automatically created table. It just uses a master and a client "Block". The master defines 3 columns and contains a "TemplateText" which is displayed before the client data. If you need more features - a lot is possible. You can split up the columns into multiple rows, use merged cells (horizontally and vertically).

Since a template lies behind each of the data cells, it is also possible to make changes to the cells. And all cells which are based on the same template will reflect the change. So it is easy to change the background color for all master rows.

Once you got use to this tool you probably will use it a lot to display and print lists or simple reports (such as invoices) right with WPTools. Instead of special export tools for your favorite "grid" control, you can display the data right in the word processor. This makes it possible to save the text as RTF, optionally as DocX or PDF right away - and, best of all, the user of your application can also change the document if they wish too. Such as changing the page size, margins, header and footer.

Components which serve for this new feature:
API: WPRichText.AddDynamicGrid() and Paragraph.GridUpdate()