Import and Export
- TRichView exports DocX, RTF, HTML, Markdown, text files, Unicode text files.
- TRichView imports RTF, text files, Unicode text files.
- TRichView saves and loads* its contents in a native format (RVF – RichView Format) and XML (with RichViewXML).
- TRichView can use text import and export converters from Microsoft® Office.
* - saving and loading refer here to operations that retain 100% of document information; exported and then re-imported documents may differ.
RTF (Rich Text Format)
RTF (Rich Text Format) is a file format that allows exchanging formatted text and graphics between different word processors in different operating systems.
Advantages of RTF:
- this is a widely recognized format; many applications support it, including WordPad and Microsoft Word;
- it can store complex formatting information, images, tables, hyperlinks, Unicode text.
Disadvantages of RTF:
- files of this format are usually large (because they contain multiple versions of the same fragments, text representation of images, redundant representation of non-English characters);
- they cannot contain some TRichView-specific information; some image formats cannot be stored in RTF and images of that formats are saved as bitmaps or metafiles.
TRichView provides events allowing programmers to insert controls in RTF, read and write hypertext links.
TRichView imports RTF files with bitmaps, Png images, 16- and 32-bit metafiles, Jpegs, external images (images in separate files).
TRichView imports RTF tables.
TRichView copies RTF into the Clipboard, TRichViewEdit copies and pastes RTF.
You can designate some text styles for using as RTF codes, and use RTF keywords in text items of these styles.
DocX (Office Open XML)
DocX files contain documents in the format called Office Open XML (also known as OOXML or OpenXML).
This is a modern file format used primarily by Microsoft Word (starting from Microsoft Office 2007), but office products created by other developers are also able to read and write this format.
Technically, DocX file is a set of XML and image files compressed in a single ZIP archive.
It can contain almost the same information as RTF files, with minor differences: for example, it supports more image formats.
DocX file is compact, because it contains less redundant information, contains images in original formats, and because all content is zipped.
TRichView can export DocX files.
You can designate some text styles for using as DocX codes, and use DocX tags in text items of these styles.
HTML (Hypertext Markup Language)
HTML is the language of the World Wide Web.
TRichView produces a smart and compact HTML code in two modes: traditional old-style (with tags like <B>,<FONT>) HTML files, and HTML files with Cascading Style Sheets (CSS).
CSS is a modern style sheet mechanism that allows authors and readers to attach styles (e.g. fonts, colors and spacing) to HTML documents.
HTML with CSS looks almost exactly like the original TRichView document when displayed in a capable browser.
Depending on settings, TRichView generates HTML conforming to the standards: HTML 4.01 Transitional or HTML 4.01 Strict. Additionally, it can generate XHTML.
TRichView exports HTML as an HTML text file and a set of image files. By default, all images are converted to Jpegs (except for Gif and Png images of standard graphic classes).
TRichView provides an event where programmers can change this behavior (for example, to save images as Png).
TRichView provides events to write inserted controls in HTML.
TRichView is able to save HTML in a stream (TStream) instead of a file. Moreover, it can be configured to save only the HTML body, making it possible to use TRichView-generated HTML as a part of larger HTML for creating complex HTML authoring tools.
You can designate some text styles for using as HTML codes, and use HTML tags in text items of these styles.
Additional information: How to save an HTML archive (both HTML and images in a single file).
TRichView does not have native methods for HTML import, but you can use RvHtmlImporter or RvHtmlViewIporter – freeware components for HTML import in TRichView.
Markdown a lightweight markup language with plain-text-formatting syntax.
It was designed to look like a plain text, and to be easy-to-read and easy-to-write. While it's easy to create Markdown using a plain text editor, a possibility to create Markdown documents using a rich text editor (like our TRichView component) is still useful.
Markdown is widely used as a format of articles and notes in CMS, issue tracking systems, web sites (including GitHub, Stackoverflow, Jira).
TRichView can save and load plain and Unicode text files. It can also copy and paste them to the Clipboard.
RVF (RichView Format)
TRichView has its own format for saving documents. This format is compact, simple, and able to contain all information from a TRichView document.
There is a set of options for loading and saving RVF. For example, text formatting (i.e. collections of text and paragraph styles) can be saved together with RVF documents or can be separated from them.
TRichView copies and pastes RVF format to the Clipboard.
XML (Extensible Markup Language)
See RichViewXML Page.
PDF (Adobe Portable Document Format)
TRichView does not have methods for creating PDF documents, but TRichView documents can be exported to PDF using third-party components (see Resources Page):
HTML import test (HTML import converters are no longer available)
Microsoft Office Text Converters
TRichView is able to use text import and export converters from Microsoft Office, with the TRVOfficeConverter component.
Import converters convert files of different formats (including DocX files) to RTF, and then TRichView loads them.
Export converters convert TRichView-generated RTF to files of different formats.
TDBRichViewEdit components can display and edit information in database fields as RVF, RTF, text, or user-defined formats.
- DB demos:
- Demos\*\DB Demos\ (Borland Database Engine version)
- Demos\*\DB Demos.BDE\ (Borland Database Engine version)
- Demos\*\DB Demos.FireDAC_IB\ (FireDAC + Interbase table version)
- Demos\Lazarus\DB Demos\ (DBF version)
- A mail merge demo:
- Demos\*\Assorted\Fields\MailMerge\ (Borland Database Engine version)
- Demos\*\Assorted\Fields\MailMerge2.BDE\ (Borland Database Engine version)
- Demos\*\Assorted\Fields\MailMerge2.FireDAC_IB\ (FireDAC + Interbase table version)
- Demos\Lazarus\Assorted\Fields\MailMerge2\ (DBF version)
Examples from the support forum: