# Rich text console A console program that stores rich text in a blob field with `TAtlasDBRichEdit`. It uses a two-row FireDAC `TFDMemTable` with an `ftBlob` field named `Notes`, and a plain `TAtlasRichEdit` from Atlas VCL to read the stored bytes back for checking. It checks, in order: 1. that `LoadRTF` writes the RTF into the current record's field and leaves the record in edit state, and that the text survives `Post` and `SaveRTF`; 2. that `FormatSelection` makes the first eight characters 18-point italic red, that `CommitToField` copies the formatted content into the field, and that the formatting is still there after `Post`; 3. that `Cancel` after a second `LoadRTF` restores the notes that were posted; 4. that bytes which do not start with `{\rtf` are refused with `EArgumentException` and the record stays in browse state; 5. that each record keeps its own notes when the cursor moves. It then writes the second record's notes to `notes.rtf`. The controls sit on a form that is never shown: a rich edit needs a parent window, not a visible one. Every step checks its own result. The program exits with code 0 when all checks pass, or prints the failed check and exits with code 1. It needs no input, database server or network. ## Build and run Open `RichTextConsole.dpr` in Delphi 13; the IDE creates the project file. Add the Atlas Info `src` folder and the Atlas VCL `src` folder to the project's search path, then build and run for Win32 or Win64. No packages need to be installed. The program needs no input. It checks its own results and stops with an error if any of them differs from the output below. ## Expected output ``` 1. Load RTF into the current record ok LoadRTF puts the record into edit state and does not post ok SaveRTF returns RTF bytes ok the text survives the round trip through the blob field 2. Format a selection and commit it ok FormatSelection starts editing the record ok the formatting is stored in the field 3. Cancel an unwanted change ok the replacement is pending ok Cancel restores the stored notes 4. Reject bytes that are not RTF ok invalid data raises and leaves the record in browse state 5. Each record keeps its own notes ok record 1 still shows its own notes ok record 2 shows the notes written to it wrote ...\notes.rtf PASS: 10 checks ``` `notes.rtf` opens in any RTF reader and shows `Notes for Harbor Services`. `SaveRTF` returns what the control holds, written out again by Windows Rich Edit, so the file is not byte-for-byte the RTF that was loaded. ## Adapting it Use a `ftMemo`, `ftWideMemo` or `ftBlob` field in your own table; a string field is refused. Keep the `Post` or `Cancel` calls in your own code: none of the `TAtlasDBRichEdit` methods ends the edit for you.