Report Workshop + ScaleRichView in read mode

Ann: TRichView 19, ScaleRichView 10, ReportWorkshop 3

We’ve released TRichView 19, ScaleRichView 10, Report Workshop 3.

Trial versions are available:
A full version can be found in the protected section of the support forum (or old setups can check for updates and download new versions).

This update is free for customers who ordered in 2019 and 2020.

Main changes since the last major update

Changes since TRichView 18:

  • import of DocX files
  • export of Markdown files
  • new TRVDataSourceLink component that helps to use TRichView or ScaleRichView as a container of data-aware controls
  • improved image scaling
  • smooth scrolling
  • improvements in text searching

Implementation of DocX import was sponsored by IBE Software, the developers of HelpNDoc, easy to use yet powerful help authoring environment which can generate various documentation formats from a single source.

Complete list:


  • SRVControls are ported to Lazarus (Windows)
  • new data-aware SRVControls
  • read mode
  • more precise way to define a range of items to print
  • smooth scrolling

Complete list: … w_10_0.htm

Report Workshop

  • expressions
  • variable assignment
  • DocX field type
  • scripts

Complete list: … istory.htm

Common changes:

  • RAD Studio 10.4 support, including per-control VCL styling

Main changes since the last public update (TRichView 18.6 and related versions of add-ons)


  • DocX import
  • improved image scaling
  • option for fast deletion of protected text


  • new TSRichViewEdit.ReadModeProperty property that configures a new “read mode” layout
  • new actions: TsrvActionLayoutSideToSide and TsrvActionLayoutRead
  • new TSRVPageScroll: SmoothScroll property
  • new TSRichViewEdit.MinPrintedOffInItem and MaxPrintedOffInItem properties to define a fragment to print

Report Workshop

  • new $SET command (variable assignment)
  • new feature: scripts (a code that is executed on certain events)
  • new functions in expression: SpellNumber, SpellCurrency, UpperFirst, Query
  • a way to implement new functions for expressions; sample custom function (Char)
  • essential table row generation rules

Microsoft Word Document (DocX) import

DocX is a format of Microsoft Word Documents.
This format is a part of Office Open XML format.
This is a default format of Microsoft Word 2007 and newer. It is supported by other applications, such as Open Office.

For years, TRichView supported export to DocX files. Since this version, it supports DocX import as well.

Like RTF, DocX was designed for MS Word, so capabilities of the both formats are very similar.
DocX is better than RTF because:

  • it’s much more compact (because it’s basically a zip file, and because it has less redundancy)
  • it supports more image types (for example, GIF, TIFF, ICO files cannot be stored in RTF, they need to be converted to other formats)
  • it supports some features that were introduced in newer versions of MS Word and were not incorporated in RTF

RTF may be better than DocX because:

  • it contains metafile representation of some content that is not supported by TRichView; TRichView will be able to load a metafile from RTF, while in DocX this unsupported content will be skipped

The following objects are supported in TRichView better in DocX than in RTF:

  • Horizontal lines: in DocX, they are saved and loaded as special objects; in RTF, they are saved as two paragraphs with a border line between them
  • Text boxes: in DocX, we implemented both import and export of text boxes; in RTF, we implemented only export of text boxes.
  • Images: left- and right- alignment of images is supported by TRichView only in DocX (however, MS Word may display these images not exactly like TRichView)


DocX import is implemented for Delphi 2009 and newer, and for Lazarus.
The main problem with Delphi 6, 7 and 2007 is an old version of ZLib included in VCL library. On request, we can try to implement DocX import in these versions of Delphi using other ZLib version.

New methods

TRichView.LoadDocX loads DocX file. More exactly, it adds a loaded content to the end of existing document, so call TRichView.Clear before.
TRichView.LoadDocXFromStream is like LoadDocX, but loads from a stream.

TRichViewEdit.LoadFromStream can detect DocX (in addition to RTF and RVF)

TRichViewEdit.LoadDocXFromFileEd inserts content of DocX file at the caret position, as an editing operation
TRichViewEdit.LoadDocXFromStreamEd is like InsertDocXFromFileEd, but inserts from a stream.

New properties

There are no new properties for DocX import. TRichView.RTFReadProperties controls both RTF and DocX import.

Data-aware controls

TDBRichView and TDBRichView support data fields containing DocX.


OpenSaveSave AsInsert File actions support DocX files.

No changes are needed in actions to support DocX, if their properties have default values.
If you modified properties, make sure that ffiDocX is included in TrvActionOpen.Filter and TrvActionInsertFile.Filter, ffeDocX is included in TrvActionSaveAs.Filter.

Report Workshop

Report Workshop supports data fields containing DocX.
RTF/DocX/RVF/text fields are auto-detected.

Third-party tools

The editor of our objects (ppRichView) for ReportBuilder can load DocX files (in addition to RTF, RVF and text files).

High-quality image scaling

Transparent images

To display resized pictures, TRichView uses a special image scaling algorithm providing high-quality scaling of images.
Before this version, this feature worked only for opaque pictures.

Since this version, high-quality scaled images are produced for semitransparent images as well.
This feature is implemented for Delphi 2009 and newer, and for Lazarus.

Images in TRVReportHelper

TRVReportHelper component is used to draw TRichView documents on external canvases (such as images, printer canvas, other components (DevExpress Grid, Virtual TreeView)).
Before this version, it did not use high-quality image scaling methods.
Since this version, they are used if AllowTransparentDrawing property = True.
Note: unlike scaling in TRichView and ScaleRichView controls, scaled images in TRVReportHelper are not cached, so drawing may become slower for large scaled pictures.

Other changes in TRichView

Protected text

TRichViewEdit prevents deletion of a part of a modify-protected text item. When attempting deleting a part of modify-protected text (by deleting a selection, Backspace or Delete keys), the deletion operation is blocked.
With the new option (rvoFastDeleteProtectedText in TRichViewEdit.EditorOptions), this behavior is modified: the whole protected text item is deleted.

ScaleRichView: Read mode

View modes

ScaleRichViewEditor can display documents in several modes:

  • Print layout: pages are displayed as they are printed; pages are displayed at the specified size and orientation; pages are scrolled vertically; pages are arranged in rows and columns.
  • Draft layout: a document is shown as a single long page; the specified page width is used.
  • Web layout: a document is shown as a single long page that always occupies the whole editor’s width. Zooming scales content, while the page size is calculated depending on the editor width and document height.

In this update, we added two more modes:

  • Side to side: like Print layout, but pages are arranged in a single row; pages are scrolled horizontally (with an optional transition effect). Zooming is calculated automatically to show pages completely. The count of visible pages can be auto-calculated or specified. For example, you can choose to display a “book view” with two pages.
  • Read mode: page size always occupies the whole editor’s area. Zooming scales content, while the page size is calculated depending on the editor size. Pages are scrolled horizontally (with an optional transition effect).

All these modes can be switched using actions. Two new actions are implemented: TsrvActionLayourSideToSide and TsrvActionLayoutRead

New property

The new mode is controlled by TSRichViewEdit.ReadModeProperty.
It is activated by assigning ReadModeProperty.Active = True. Side-to-side and Read-mode are selected by assigning False/True to TSRichViewEdit.PageProperty.AutoWidth.

ReadModeProperty has properties:

  • MinPageColCount, MaxPageColCount – minimal and maximal count of visible pages in side-to-side mode
  • PageFlipEffect – effects for scrolling pages (none / stack / scroll / fade)
  • PageColor overrides color of pages in a read mode
  • HidePageBackgroundImage allows hiding background page image in a read mode

PageFilpEffect defines a page transition effect. It displays a short animation when scrolling by one page.

  • none: fast scrolling, no effects
  • stack: slide pages as if the outermost visible pages represent page stacks
  • scroll: scroll pages from/to outside
  • fade: pages appear on new places gradually (available for Delphi 2009 and newer).

The default effect for the side-to-side action is “stack”. See Gif animation
The default effect for the read-mode action is “scroll”. See Gif animation

Changes in demo projects

View modes in ScaleRichView editor

All ScaleRichView ActionTest demo projects (main projects demonstrating capabilities of ScaleRichView as a word processor) have new actions included. New read modes are added as buttons in the horizontal scrollbar area. A new “View” main menu item is added. It contains the view mode switching actions and other commands related to appearance.
All ScaleRichView + ReportWorkshop ReportEditor demos have these actions as well. Modes are added in the horizontal scrollbar area, but “View” menu is not added in ReportEditors.

ScaleRichView: other changes

Smooth scrolling

Smooth scrolling was implemented in the previous update of ScaleRichView.
In this update, we extended this feature by:

TSRVPageScroll displays page thumbnails for convenient navigation in a document displayed in TSRichViewEdit component.
If TSRVPageScroll.SmoothScroll = True, when the user clicks on the page thumbnail, the editor will be scrolled to the clicked page smoothly. Otherwise, it will be scrolled fast without effects.

Incremental printing

ScaleRichView editor allows defining a range of items to print. Pages outside this range will not be printed. Content outside this range will not be printed, but still occupies its space.
This feature allows to implement an incremental printing: a page can be printed in several steps. It may be useful when printing content that was added after the last printing.

Before this update, the range of printed items was defined by MinPrintedItemNo and MaxPrintedItemNo properties. However, a text item can be displayed on several lines. Sometimes, it is desirable to print only some of these lines. The new properties MinPrintedOffsInItem and MaxPrintedOffsInItem allow to define a printing range with up-to-line precision.


TSRVDxSkinAdapter component allows using DevExpress skins in ScaleRichView editor.

Changes in this update:

  • skins are applied to buttons in scrollbar areas
  • skins are applied to not only TSclRVRuler, but also to TRVRuler components

ReportWorkshop: new functions

Report Workshop is a reporting add-on. It allows to build rich-text reports in TRichView and ScaleRichView editors.

In the previous update, expressions were introduced. They can be used to insert values in text, calculate conditions of $if command, visualize values.
Expressions may call functions (on text, numeric, logical, date-time arguments).
The syntax of expressions and the list of functions are described here:

In this update, we added several new functions for expressions.


SpellNumber() converts the integer value to text in the specified Language.
The function supports: English, Portuguese (European and Portuguese), Russian. More languages will be added on request.
For example, SpellNumber(25,”en”,””) returns “one hundred and twenty five”.
This function supports the following options:
– grammatical gender (useful in Russian and Portuguese)
– monetary spelling rules (useful in English)


SpellCurrency() converts the monetary value to text in the specified Language.
The function supports the languages: English, Portuguese (European and Portuguese), Russian. More languages will be added on request.
The function supports the currencies: USD, EUR, BRL, RUB. More currencies will be added on request.
This function supports the following options:
– returning a fractional value (cents) as digits
– not including zero fractional value (0 cents) in the result.


UpperFirst() converts the first letter of text to upper case.
This function includes special processing for characters that have special title case variant, different from an upper case.
For example, a ligature “lj” is converted to a ligature “Lj”, not to “LJ”.
This function is especially important with conjunction of SpellNumber and SpellCurrency.


Query() executes a data query and returns its result as a text string.
This function adds one more way of linking reports to data.

So the following ways to display data are available:

  • a data query linked to the whole report (repeating report template for each record)
  • a data query linked to table rows or a group of table cells (repeating rows or cells), called “table row generation rules”
  • a data query linked to table cell (repeating a cell content)
  • Query() function.

Query function accepts the parameters:

  • data query string (such as a table name or a SQL SELECT statement)
  • format string (defines how each record will be represented in the result)
  • delimiter (string between records).

Example: Query(“select * from FruitTable”, “{FruitName}”, “, “) returns a string like “apple, orange, peach”.

Values passed to this function arguments can contain expressions as well, so calls of Query() function can be nested to create master-detail reports.

ReportWorkshop: custom functions

The previous version of Report Workshop allowed implementation of custom aggregate function for cross-tab reports (a sample Median function was included).

Since this version, you can implement your own functions for expressions as well. A sample Char function (converting UTF-32 code to character) is included, see RVReportCharCodeCalculator.pas (included as a source both in the full and the trial version, in ReportWorkshop\Core\Source\ folder)

Demo projects

The main demo projects for report are ReportEditor demos. They are available for FireDAC, IBX, BDE, ZEOS, NexusDB, ElevateDB, MicroOLAP DACs.
In the main window of these demos, there is a report Report Design Helper panel.
Since this update, it includes the new functions (SpellNumber, SpellCurrency, UpperFirst, Query), as well as functions implemented as add-ons (like Char).

Report Workshop: variable assignment and scripts

$SET command

A new $SET command as added. This command assigns a value to a report variable.

$set %my_variable to "Hello world"


$set %my_variable = "Hello world"

The first syntax reports an error when assigning an undefined variable.
The second syntax creates a new variable, if it was undefined.

See the syntax of commands here:


Script is a text string containing commands to execute.

Scripts are executed on report generation, when certain events occur.

The following scripts are available:

  • Script_OnStart, Script_BeforeRecord, Script_AfterRecord, Script_OnEnd associated with a whole report template
  • Script_OnStart, Script_BeforeRecord, Script_AfterRecord, Script_OnEnd associated with a table row generation rule.

Each script line contains one command. It may be $SET or $IF ($ELSE, $ENDIF) command. The starting “$” may be omitted.

See the syntax of scripts here:

Demo projects

The new tutorial demo projects were added for FireDAC and IBX: “6 – Master-detail SQL with scripts”.
These projects are very similar to “3 – Master-detail SQL”, they create a master-detail report displaying lists of parts provided by vendors.
Differences from the demo #3:
1. SQL functions (for calculating the count of parts provided by a vendor) are not used in this demo.
2. The script associated with the whole reports calculates the variables:
– %vendorcount – total count of vendors
– %validvendorcount – count of vendors that provide at least one part
This information is added to the end of the report after generation.
3. The script associated with the table’s row generation rule calculates the variables:
– %part_count – count of parts provided by the current vendor
– %sum_price – sum of prices of parts provided by the current vendor
– %avg_price – average price of parts provided by the current vendor
%avg_price is displayed in the last table row.

Master-detail report with script: template
Master-detail report with script: result

As you can see, scripts allow calculating aggregate functions for non-crosstab reports without calling SQL functions. It is especially useful for non-SQL data sources.

Report Workshop: other changes

Essential table row generation rules

New Essential property for table row generation rules.
If an essential rule returns 0 records, the whole report table will be deleted.
This property is used in “”6 – Master-detail SQL with scripts” demo described above.

UI translations

The following translations of RichViewActions UI were updated:

  • Farsi (thanks to Mehrdad Esmaeili)
  • Finnish (thanks to Teijo)

The following new translations of Report Workshop UI were added:

  • Finnish (thanks to Teijo)
  • Portuguese – European (thanks to Bruno Martins)

ScaleRichView has new UI strings to localize: captions and hints for “Side to Side” and “Read Mode” actions.
Currently, they are translated only to Russian (other languages have them in English).
I ask translators to update their translations.

Time limited offer

We offer 15% discount on TRichView, ScaleRichView, Report Workshop till the end of this year.
The discount can be applied to new licenses and renewals (except for subscriptions with recurring payments).

To apply, enter Happy2021 in as a coupon code in the ordering form.

Merry Christmas!

Share this article