Rich View Format compatibility

General TRichView support forum. Please post your questions here
Post Reply
mweis
Posts: 4
Joined: Thu Jan 26, 2023 10:21 pm

Rich View Format compatibility

Post by mweis »

Hello!. My company uses TRichView components in applications built with Delphi 10 Seattle. We are porting one of these applications to the web with Microsoft based C# and a SQL Server backend, with an Angular front end. We store data in our database in Rich View Format and want to use it in our web application's UI (for both read and write access). Outside of converting to HTML, which we are doing but find has limitations, is there any support for this format using this other programming language stack?
Sergey Tkachenko
Site Admin
Posts: 17521
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Rich View Format compatibility

Post by Sergey Tkachenko »

Sorry, no.
Convert documents to standard format, such as RTF, DocX or HTML.
mweis
Posts: 4
Joined: Thu Jan 26, 2023 10:21 pm

Re: Rich View Format compatibility

Post by mweis »

Thank you. The documentation indicated as such.

In the use case I've described, we are considering a migration to RTF format. Per the TRichView documentation on exporting to RTF, RTF "cannot contain some TRichView-specific information". Would this be embedded controls only or is there additional types of information it can't support? Using the library can we know if an RVF blob contains RTF incompatible information?

Secondly, regarding embedded images, if we are storing in RVF any of these image types: "bitmaps, metafiles or Png images", then these would be saved in image file(s) separate from the RTF, is that correct?
Sergey Tkachenko
Site Admin
Posts: 17521
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Rich View Format compatibility

Post by Sergey Tkachenko »

Sorry, I do not have a complete list of features that cannot be stored in RTF. Generally, all most frequently used properties are saved.
Some of unsaved features: background images (of tables, cells, document), vertical align options of images (including left- and right- align), semitransparent backgrounds, text overline, independent offsets of paragraph border and background, separate table border if cell borders are collapsed.

Images are stored inside RTF, not as separate files. RTF can contain Windows bitmaps, Windows metafiles, Jpegs, Png. Other images are converted according to TRichView.RTFOptions (it is possible to store images in separate files outside RTF with some efforts, see the demo TRichView\Demos\DelphiUnicode\Assorted\Graphics\SharedImages\)
mweis
Posts: 4
Joined: Thu Jan 26, 2023 10:21 pm

Re: Rich View Format compatibility

Post by mweis »

Thanks again. I don't suppose you are able to confirm or deny that any legitimate RTF content can be imported into TRichView without loss of information (going in the other direction, so to speak)? I ask in the context of persisting RVF as RTF via TRichView, and subsequently allowing edits to that persisted RTF by TRichView (in our current application) or by an independent RTF editor in our newer application on the web.

Stating it another way, not all RVF can reside in RTF as you have stated, but can all RTF reside in RVF?
mweis
Posts: 4
Joined: Thu Jan 26, 2023 10:21 pm

Re: Rich View Format compatibility

Post by mweis »

Hello. I very much appreciate your feedback so far. We use tags in RVF content to hold integer values each of which are a reference to some other string value. The tag is used in a call to SetItemText to update the tagged document item with that value. I'm finding, after saving an RVF blob containing tags to RTF and then loading the same RTF blob back into the TRichViewEdit control, that the functionality depending on the tags is no longer working. Also, when I save the RVF to disk with SaveRTF there's no evidence the tag values are present. Are document item tags not included in the export to RTF? We are using an older version of the library (v16.14). Might the latest version be saving the tags in RTF?
Sergey Tkachenko
Site Admin
Posts: 17521
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Rich View Format compatibility

Post by Sergey Tkachenko »

Yes, tags cannot be stored in RTF.
RTF and DocX are formats that were created for MS Word, while RVF was created for TRichView.
So, RTF and DocX can contain every feature that can be found in MS Word document, and RVF can contain every feature that can be found in TRichView document.
When loading RTF in TRichView, TRichView loads all content that is supported (i.e. common for TRichView and MS Word); other content is either converted to the most similar TRichView analogs, or is ignored. For saving RTF, TRichView does a similar work in the opposite direction.
The same for DocX and HTML.

Yes, tags cannot be saved in RTF, because MS Word does not have this feature. Theoretically, RTF is an extendable format: it is possible to use new keywords that will be ignored by other RTF readers, but read by TRichView, However, TRichView does not use this approach: it uses only standard RTF keywords.

If your application needs TRichView-specific features, I can suggest making two copies of each document: in RVF and on more compatible formats.
Post Reply