RiverWare 6.7 Model Report Enhancements: Image Items and Rich Text
Phil Weinstein, David Neumann, Patrick Lynn, Edie Zagona, CADSWES, 5-4-2015
The following two enhancements have been developed for RiverWare Model Reports:
A new "Image" menu item is available from the Report Layout panel's "Add Item" combo box and from the Report Layout item tree's context menus. Selecting "Image" brings up a file selector to pick an image file ...
After picking an image file, a new Image item is created with the image data from that file. (The image data is maintained within the model report configuration).
Image items support two settings:
|
![]() |
The Image Name setting is initialized from the picked image file. Its only use is identifying the image item within the Report Layout item tree.
Optional "Caption" text can be specified with each image item. In the generated model report, caption text is shown under the image. For sufficiently wide images (at least 300 pixels wide), the caption is horizontally centered below the image and wrapped to the image width. Captions for narrower images are not constrained in this way; they appear under the image, left aligned, and flowing to the full display width of the generated model report page.
The full model report content -- or optionally just a single selected report item -- can be previewed by clicking the green-circle-arrow preview refresh button at the top of the Report Preview panel.
It is not currently possible to choose a different image for an existing image item. If a different image is desired, a new image item must be created. (The user may wish to retain the old image item during the creation of the new image item so that the old image caption text can be copied and pasted to the new image item).
When the Model Report HTML document is generated, new image files are created for model report image items in a similar way as images for slot plots, but using the binary image data loaded from the original source image file.
Special note regarding potential impact of Image Items on model size and model load times:
Unlike slot plots for which images are dynamically constructed as needed, Image Item image data is stored in the model file (in the model report output device configuration record). Including many large images in a model report configuration could potentially significantly increase the size of the model file and could result in slower model file loading. If this becomes a problem, e.g. with a production model which needs to be regularly run, the user could choose to manually maintain large Model Report configurations as separate (exported) output device files.
This would be done by exporting the model report output device configuration, deleting that output device from the model, resaving the model, and subsequently temporarily reloading the model report output device configuration (without resaving the model) for the purpose of generating the model report.
Image data size statistics are not currently displayed within the RiverWare user interface. Those statistics can be seen in uncompressed copies of the model file or model report output device export files. Each image item's basic statistics are available on a single text line; search or "grep" for "BinaryData". Here is an example of such a line for the example shown above:
<BinaryData appl="Image" name="PieChart" width="400" height="265" sizeRaw="186818" sizeB64="252985">
- "width" and "height" are in pixels.
- "sizeRaw" shows the number of bytes of actual binary image data, as loaded from the original model file.
- "sizeB64" shows the number of bytes of the image data, as encoded within the model file or output device export file. This is approximately 33% larger than the binary data. This is encoded in a standard way using ASCII text characters representing base-64 values (i.e. 6 bits of actual binary data in each 8-bit character; nominally 75% efficient).
RiverWare Model Report Text Items now support a "Rich Text" mode for basic HTML-based formatting.
Note: This "Rich Text" support is not related to the "RTF" Rich Text Format. The text attributes and basic formatting supported here are implemented with a common HTML subset. RTF is an old proprietary Microsoft format, and is not actually a preferred technology.
Newly created Model Report Text Items are in the "Rich Text" mode by default. This is controlled with a "Type" combo box setting with two choices, Plain Text or Rich Text:
When in Rich Text mode, a new, more advanced editor is shown for editing the text item content. This is initiated by clicking the ellipsis button after double-clicking in the Text setting's value field ...
In Rich Text mode, content can be edited only in a new editor dialog -- the line editor in the settings panel showing the first part of a plain text version of the content is read-only (not editable).
![]() |
|
![]() |
|
![]() |
The Rich Text editor supports many common formatting operations; these are generally applied to the selected portion of the text content. Copying and pasting basic formatted text content from an external application (e.g. a web browser, or Microsoft Word) -- via the system clipboard -- is supported. Also, it is possible to "Import" an existing HTML or text document; doing so replaces the editor's prior content.
The editor supports "Undo" and "Redo" operations, so it is very reasonable to experiment with the available formatting operations. However, the graphical rendering by this editor doesn't precisely match the appearance of content in the generated HTML document. Formatting should be checked in the Model Report configuration dialog's preview panel after applying changes to rich text Text items.
Note: The Rich Text editor is not a full-blown HTML editor and may not work well for certain complex formatting. As more advanced editing tools become available (e.g. after porting RiverWare from Qt4 to Qt5), we might choose to replace this editor with something better.
Any font on the user's system can potentially be applied to rich text content. (A typical Windows system supports over 300 different font faces). However, since the generated RiverWare Model Report is an HTML document, and since web browsers generally rely on the fonts available on the viewer's system, we recommend that users make use of the "Only Web-Safe Fonts" option which limits the font selection to fourteen (14) of the most commonly supported fonts:
Note: The current rich text editor implementation doesn't correctly handle "fallback" fonts, i.e. a list of alternative font faces to be used in case the first choice is not available on the user's system. Not being able to provide fallback fonts increases the importance of using common ("web safe") fonts in rich text Text items. This editor limitation could potentially also cause problems with content copied or imported from an HTML document, as the rich text editor actually corrupts CSS font-family style specifications having multiple fonts; the result is that none of the specified fonts work, and the web browser uses just its default font.
- Technical: The low-level Qt4 QTextEdit widget implementation places single quotation marks around the full list of font face names in a CSS font-family style specification. Such a thing can be done for a single font face name, but not for a comma separated list of font face names. That is not valid CSS syntax. For example, the following CSS style is invalid:
<span style="font-family:'Verdana,Algerian,sans-serif'; font-size:10pt;">
Once rich text has been entered, switching back to "Plain Text" mode causes the loss of any formatting and text attributes which had been applied. For this reason, the following confirmation dialog is presented to the user when selecting "Plain Text" ...
--- (end) ---