TRichView 19, ScaleRichView 10, Report Workshop 3 - DocX, read mode, simple scripts

News about TRichView, ScaleRichView, ReportWorkshop, RVMedia
Post Reply
Sergey Tkachenko
Site Admin
Posts: 17553
Joined: Sat Aug 27, 2005 10:28 am
Contact:

TRichView 19, ScaleRichView 10, Report Workshop 3 - DocX, read mode, simple scripts

Post by Sergey Tkachenko »

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

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

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

Previous version:
https://www.trichview.com/forums/viewto ... =6&t=10073
Sergey Tkachenko
Site Admin
Posts: 17553
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Main changes since the last major update

Post by Sergey Tkachenko »

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: https://www.trichview.com/help/new_in_version_19.html

ScaleRichView
  • 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: https://www.trichview.com/help-scaleric ... w_10_0.htm

Report Workshop
  • expressions
  • variable assignment
  • DocX field type
  • scripts
Complete list: https://www.trichview.com/help-report/v ... istory.htm


Common changes:
  • RAD Studio 10.4 support, including per-control VCL styling
Sergey Tkachenko
Site Admin
Posts: 17553
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Main changes since the last public update

Post by Sergey Tkachenko »

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

TRichView
  • DocX import
  • improved image scaling
  • option for fast deletion of protected text
ScaleRichView
  • 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
Sergey Tkachenko
Site Admin
Posts: 17553
Joined: Sat Aug 27, 2005 10:28 am
Contact:

DocX import

Post by Sergey Tkachenko »

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)
Compatibility

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.

RichViewActions

Open, Save, Save As, Insert 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).

I prepared a DocX file that contains almost all content that can be imported in TRichView:
DocXImportTest.zip
(100.12 KiB) Downloaded 10226 times
You can see results on the screenshot below:
DocXImportTest.png
DocXImportTest.png (34.69 KiB) Viewed 225873 times
Sergey Tkachenko
Site Admin
Posts: 17553
Joined: Sat Aug 27, 2005 10:28 am
Contact:

High-quality image scaling

Post by Sergey Tkachenko »

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.
Sergey Tkachenko
Site Admin
Posts: 17553
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Other changes in TRichView

Post by Sergey Tkachenko »

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.
Sergey Tkachenko
Site Admin
Posts: 17553
Joined: Sat Aug 27, 2005 10:28 am
Contact:

ScaleRichView: Read mode

Post by Sergey Tkachenko »

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).
ScaleRichView-View-Modes.png
ScaleRichView-View-Modes.png (254.28 KiB) Viewed 225622 times

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

ViewModes.png
ViewModes.png (130.67 KiB) Viewed 225869 times

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.
Sergey Tkachenko
Site Admin
Posts: 17553
Joined: Sat Aug 27, 2005 10:28 am
Contact:

ScaleRichView: other changes

Post by Sergey Tkachenko »

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.

SRVDXSkin

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
Sergey Tkachenko
Site Admin
Posts: 17553
Joined: Sat Aug 27, 2005 10:28 am
Contact:

ReportWorkshop: new functions

Post by Sergey Tkachenko »

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: https://www.trichview.com/help-report/expressions.htm

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

SpellNumber()

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(125,"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()

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()

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()

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.
Sergey Tkachenko
Site Admin
Posts: 17553
Joined: Sat Aug 27, 2005 10:28 am
Contact:

ReportWorkshop: custom functions

Post by Sergey Tkachenko »

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

rw-funcs.png
rw-funcs.png (29.56 KiB) Viewed 225087 times

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).
Sergey Tkachenko
Site Admin
Posts: 17553
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Report Workshop: variable assignment and scripts

Post by Sergey Tkachenko »

Report Workshop: variable assignment and scripts

$SET command

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

Code: Select all

$set %my_variable to "Hello world"
Or

Code: Select all

$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: https://www.trichview.com/help-report/commands.htm

Scripts

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: https://www.trichview.com/help-report/scripts.htm

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-With-Scripts-Template.png
Master-Detail-With-Scripts-Template.png (11.65 KiB) Viewed 225868 times
Report template
Master-Detail-With-Scripts-Result.png
Master-Detail-With-Scripts-Result.png (23.02 KiB) Viewed 225868 times
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.
Sergey Tkachenko
Site Admin
Posts: 17553
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Report Workshop: other changes

Post by Sergey Tkachenko »

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.
Sergey Tkachenko
Site Admin
Posts: 17553
Joined: Sat Aug 27, 2005 10:28 am
Contact:

UI translations

Post by Sergey Tkachenko »

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.
Sergey Tkachenko
Site Admin
Posts: 17553
Joined: Sat Aug 27, 2005 10:28 am
Contact:

TRichView 19.1

Post by Sergey Tkachenko »

TRichView 19.1 and ScaleRichView 10.1 have been released.

DocX import

Shades of theme colors were not imported (were imported as pure theme colors). Fixed.

Bidirectional text

This version improves support for right-to-left layout in TRichView and ScaleRichView.
If the editor's BiDiMode = rvbdRightToLeft, then:
- line selection works on the right margin (previously, it was disabled in RTL mode)
- in ScaleRichView, if pages are arranged in multiple columns, pages in each row are ordered from right to left (it's especially important in the new read/side-to-side mode)
- in ScaleRichView, left and right values of PagePosProperty.AlignPageH are exchanged.

hebrew-book.png
hebrew-book.png (108.77 KiB) Viewed 223883 times

Tables

1) Previously, both Delete and Backspace keys cleared content of selected cells.
Since this version:
- Delete clears selected cells, like before
- Backspace deletes rows (if rows are selected) or columns (if columns are selected), or the whole table (if all cells are selected). For all other types of selection, it does nothing.

Sometimes it's undesirable to allow quick row/column/table deletion, so there is a possibility to turn off this feature.
If you assign the global variable RichViewTableAutoAddRow = False, it prevents not only adding rows by pressing Tab in the last cell, but also deletion with Backspace.

2) Since this version, table deletion, table.DeleteSelectedRows, table.SelectedCols do not work if this operation would lead to deletion of protected items in cells.

Other changes

Minor changes in drawing placeholders for text boxes.
New global variable:
RVAlwaysShowPlaceholders: Boolean = False.
If you set it to True, text box placeholders will be always drawn, even if rvoShowSpecialCharacters is excluded from RichView.Options.

View modes in ScaleRichView

This update includes several fixes for switching view modes in ScaleRichView and drawing pages in a read mode.
A new page transition effect is added: "PopUp". It works like "Stack" effect, but page popup/down movement is amplified to the maximum.
Sergey Tkachenko
Site Admin
Posts: 17553
Joined: Sat Aug 27, 2005 10:28 am
Contact:

TRichView 19.1.2

Post by Sergey Tkachenko »

TRichView 19.1.2

This is a maintenance release, it has fixes and tweaks related to DocX and RTF import.
Post Reply