Page 1 of 1

TRichView 19.2, ReportWorkshop 3.1 - Markdown, lists, calendar functions

Posted: Wed Mar 24, 2021 5:25 pm
by Sergey Tkachenko
Our components were updated: TRichView 19.2, ScaleRichView 10.1.1, Report Workshop 3.1

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

In this update:
  • Markdown import
  • improvements in paragraph list and HTML
  • new calendar functions for ReportWorkshop expressions
  • special support for commercial version of Adit Math Engine
  • AbsoluteDB demo for ReportWorkshop
Units of the free version of Adit Math Engine (that are included in TRichView setup) were renamed, so I highly recommend to uninstall the old version of TRichView before installing this update.

Previous version:
https://www.trichview.com/forums/viewto ... =6&t=10285

Markdown

Posted: Wed Mar 24, 2021 5:46 pm
by Sergey Tkachenko
Markdown

Markdown import

Markdown is a lightweight markup language for creating formatted text.
We implemented Markdown export in TRichView 18.x, and now we implemented Markdown import.

TRichView has the following new methods: The following content can be imported:
- paragraphs and headings with formatted text
- code blocks (as paragraph of a special style)
- block quotes (as paragraphs of a special style, a level of nesting is shown by left indents)
- multilevel bullets and numberings
- thematic breaks
- tables

Paragraphs may contain the following formatting: emphasis, strong emphasis, code spans.
Documents may contain images (from external sources) and hyperlinks.

TRichView follows CommonMark Markdown Specification.
All Markdown syntax is supported, except for HTML tags. Only two of them are processed: <br> creates a line break, <!-- HTML comments --> are discarded (well, there are undocumented events to process other HTML tags, contact me if you are interested).

Document appearance

Appearance of the imported document depends on the mode of using styles (StyleTemplates).
If named styles (StyleTemplates) are used, they are applied. For example, block quote paragraphs are formatted using "Quote" style, emphasized text is formatted using "Emphasis" style, etc.
Otherwise, some default formatting is used (such as italic for emphasized text).

Tables

Tables are not included in the standard Markdown specification, however, there is a widely used Markdown extension (for example, it is used in GitHub Flavored Markdown).
TRichView supports both import and export of tables in Markdown.

Differences between Markdown import and export in TRichView

Not every Markdown content can be represented in TRichView as it is.
For example, in TRichView, list items are paragraphs, while in Markdown they may contain subdocuments.
When importing, TRichView uses indents to show level of nesting of list items and block quotes. As a result, everything looks like it was designed, but the internal structure is different. On export, only single paragraphs belong to each list item, and only a single level of block quotes can be exported.
Also, the current version of TRichView does not support export of code blocks and code spans (it will be implemented in future updates).
Also, a footnote Markdown extension is currently supported only on export (import will be implemented in future updates)

Other methods supporting Markdown

LoadFromStream is the method that detects a format for loading. It can detect RTF, RVF, DocX. Now, if none of these formats is detected, you can choose from loading the stream as a text or as a Markdown.

Markdown in additional components

Posted: Wed Mar 24, 2021 5:58 pm
by Sergey Tkachenko
Markdown in additional components

Markdown in RichViewActions

Previously, Markdown was supported only in File Export action.
Since this version, it is supported in Open and Save As actions, as well as in Insert File action.

Markdown in ReportWorkshop

A new type of data fields is added: "markdown".
The syntax for insertion of Markdown field in the document is {FIELDNAME markdown}

New list styles

Posted: Wed Mar 24, 2021 6:08 pm
by Sergey Tkachenko
New list styles

New list styles are available for bullets and numbering:
  • lower Greek: α, β, γ, ..., ω, αα, αβ, ...
  • decimal with leading zero: 01, 02, 03, ...
RichViewActions support new list types in the list dialog:
listdialog.png
listdialog.png (62.59 KiB) Viewed 60031 times

Lower Greek numbering is supported in HTML, decimal with leading zero is supported in HTML, RTF, DocX.

New format of integer values in ReportWorkshop

ReportWorkshop supports lower Greek as a format string for integer values:
{VALUE "greek"}
ReportWorkshop does not need a special type for decimal with leading zero, it already can specify it as "decimal2"

Equation objects

Posted: Wed Mar 24, 2021 6:24 pm
by Sergey Tkachenko
Equation objects

TRichView includes a special document item type: Mathematical expressions
Previously, this item used a free version of Adit Math Engine.

Now, it supports both the free and the commercial version (which API now differs from the free version).

The following changes were made:
  • units of the free version of Adit Math Engine were renamed (MathEquation.pas to RVMathEquation.pas, Math.inc to RVMath.inc, etc.) Because of this change, I highly recommend to uninstall the old version of TRichView before installing this update (to remove the old units). The original names (MathEquation.pas, etc.) are now used by the commercial version of Adit Math Engine (that can be ordered from Adit Software).
  • A single package for math item was separated into 3: a package for math item, a package for the free version of AME, a package for integration of the commercial version of AME.
  • (compatibility!) to use a free version of AME, include RVBasicMathWrapper unit in your project. To use a commercial verison of AME, include RVAdvMathWrapper unit in your project.
TRichView does not use a full power of the commercial version of AME yet.
It has very interesting features that will be integrated in future TRichView releases:
- extended syntax (new types of equations will be added in RichViewAction equation editor)
- import and export to various formats (that will allow to store them as equations instead of images in RTF, DocX and HTML)
- interactive content (such as hyperlinks inside equations)
- multiline expressions

The demos that use AME were modified: RVBasicMathWrapper was added to "uses".
This change includes: ActionTest_MultiRes demos for TRichView and ScaleRichView, ReportEditor_MultiRes demos for Report Workshop.

HTML improvements

Posted: Wed Mar 24, 2021 6:37 pm
by Sergey Tkachenko
HTML improvements

Lists

Previously, when exporting and importing paragraph numbering in HTML, TRichView always specified list counter values, such as:

Code: Select all

<ol>
  <li value="1">one</li>
  <li value="2">two</li>
</ol>
It was done because HTML and TRichView use different models of paragraph lists (TRichView uses multilevel lists in Microsoft Word style, HTML uses single level nested lists), so counters may be calculated differently.

Since this version, counter values are exported and imported only when it is really necessary.

Embedded images

The code for reading HTMLs containing images embedded directly in <img src> is improved. Now it supports HTML entities (sometimes, line breaks may be encoded using them) and %-encoded plus characters.
This improvement was added both in TrvHtmlImporter and TrvHtmlViewImporter.

HTML entities

Since this version, TrvHtmlImporter (as well as Markdown import methods) understands all HTML5 named character entities (more than 2000 of them).

Table columns

TrvHtmlImporter supports <colgroup> and <col> tags (for assigning width of columns in pixels or percent, and for assigning background colors)


There are some other tweaks in TrvHtmlImporter.

DocX improvements

Posted: Wed Mar 24, 2021 6:41 pm
by Sergey Tkachenko
DocX improvements

The code for saving bi-directional text in DocX was improved.
Bi-directional overrides are supported both in DocX saving and loading methods.

New functions for expressions in ReportWorkshop

Posted: Wed Mar 24, 2021 6:50 pm
by Sergey Tkachenko
New functions for expressions in ReportWorkshop

We added the following new functions in Report Workshop expressions:
  • GetDayOfWeek(Date) - returns the day of week (from 1 to 7, where 1 is Monday) of Date
  • GetWeekOfMonth(Date) - returns a number (from 1 to 5) indicating which week of the month the date Date falls in
  • MonthName(Month) - returns a name of the Month (where Month is a number from 1 to 12)
  • MonthShortName(Month) - returns a shortened name of the Month (where Month is a number from 1 to 12)
  • DayOfWeekName(DayOfWeek) - returns a name of the DayOfWeek (where DayOfWeek is a number from 1 to 7, 1 means Monday)
  • DayOfWeekShortName(DayOfWeek) - returns a shortened name of the DayOfWeek (where DayOfWeek is a number from 1 to 7, 1 means Monday)
The following two examples display the current day of week:

Code: Select all

{=DayOfWeekName(GetDayOfWeek(CurDate()))}
{=CurDate() "dddd"}

New ReportWorkshop demo projects: AbsoluteDB

Posted: Wed Mar 24, 2021 6:58 pm
by Sergey Tkachenko
New ReportWorkshop demo projects: ReportEditor for AbsoluteDB

A new ReportEditor demo was added.
It allows building reports on data from Absolute Database.

The demo is in <TRichView Dir>\ReportWorkshop\Demos\Delphi\AbsoluteDB\ folder.

There are two main sets of demo projects:
- ReportEditor - uses TRichViewEdit
- ScaleRichViewReportEditor - uses ScaleRichView.

The demos have the following versions:
- DelphiOld - for Delphi 2007 and older (16-color toolbar images)
- DelphiUnicode - for Delphi 2009 and newer (semitransparent toolbar images)
- DelphiUnicode_MultiRes - for Delphi 10.3 and newer (multi-resolution toolbar images, "Per Monitor v2" support)


How to make simple reports:

Localization

Posted: Wed Mar 24, 2021 7:01 pm
by Sergey Tkachenko
Localization

UI translation:
- Spanish ScaleRichView translation is updated (thanks to Raúl Izquierdo)

Re: TRichView 19.2, ReportWorkshop 3.1 - Markdown, lists, calendar functions

Posted: Wed Mar 24, 2021 7:19 pm
by Sergey Tkachenko
Ctrl+Up and Ctrl+Down

When the user presses Ctrl+Up or Ctrl+Down, the editor is scrolled, while the caret remains at the same position in text. Delphi code editor works in the same way.

Since this version, you can change this behavior, and move the caret to the beginning of the current/next paragraph (like Microsoft Word does).

RichViewCtrlUpDownScroll variable controls this behavior.