Import and Export
- TRichView exports DocX, RTF, HTML, Markdown, PDF*, text files, Unicode text files.
- TRichView imports DocX, RTF, HTML*, text files, Unicode text files.
- TRichView saves and loads** its content in a native format (RVF – RichView Format) and XML (with RichViewXML).
- TRichView can use text import and export converters from Microsoft® Office.
* with help of additional components
** 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, footnotes, endnotes, text boxes, 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, metafiles or Png images.
TRichViewEdit reads, writes and inserts RTF files, copies and pastes RTF to/from the Clipboard, exchanges data in RTF format using drag and drop.
You can designate some text styles for using as RTF codes, and use RTF keywords in text items of these styles.
TRichView provides events to write inserted controls in RTF.
Microsoft Word Document: 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 files are compact, because they contain less redundant information, contain images in original formats, and because all content is zipped.
TRichViewEdit reads, writes, and inserts DocX files and streams.
You can designate some text styles for using as DocX codes, and use DocX tags in text items of these styles.
TRichView provides events to write inserted controls in DocX.
The minimum compiler version required for DocX reading and inserting: Delphi 2009 or newer, C++Builder 2009 or newer, Lazarus.
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).
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) or to send HTML-formatted e-mail.
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):
Microsoft Office Text Converters
TRichView is able to use text import and export converters from Microsoft Office, with the
Import converters convert files of different formats to RTF, and then TRichView loads them. Export converters convert TRichView-generated RTF to files of different formats.
This is an obsolete technology. We recommend using other methods for importing and exporting files (including the built-in TRichView DocX import and export functions).
TDBRichViewEdit components can display and edit information in database fields as RVF, RTF, DocX, 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: