diff --git a/components/fpspreadsheet/examples/other/metadata/demo_metadata.lpr b/components/fpspreadsheet/examples/other/metadata/demo_metadata.lpr
index 99de02103..7bd69fb79 100644
--- a/components/fpspreadsheet/examples/other/metadata/demo_metadata.lpr
+++ b/components/fpspreadsheet/examples/other/metadata/demo_metadata.lpr
@@ -93,9 +93,9 @@ begin
book := TsWorkbook.Create;
try
// Select one of these
-// book.ReadFromFile('test.ods');
-// book.ReadFromFile('test.xlsx');
- book.ReadFromFile('test.xml');
+// book.ReadFromFile(dir + 'test.ods');
+// book.ReadFromFile(dir + 'test.xlsx');
+ book.ReadFromFile(dir + 'test.xml');
WriteLn('Created by : ', book.MetaData.CreatedBy);
WriteLn('Date created : ', DateTimeToStr(book.MetaData.DateCreated));
WriteLn('Modified by : ', book.MetaData.LastModifiedBy);
diff --git a/components/fpspreadsheet/examples/other/other_demos.lpg b/components/fpspreadsheet/examples/other/other_demos.lpg
index 7cc585fdf..f4e5c1c41 100644
--- a/components/fpspreadsheet/examples/other/other_demos.lpg
+++ b/components/fpspreadsheet/examples/other/other_demos.lpg
@@ -57,6 +57,11 @@
+
+
+
+
+
diff --git a/components/fpspreadsheet/examples/other/readme.txt b/components/fpspreadsheet/examples/other/readme.txt
index f4b1123e8..14dd20ebb 100644
--- a/components/fpspreadsheet/examples/other/readme.txt
+++ b/components/fpspreadsheet/examples/other/readme.txt
@@ -26,6 +26,8 @@ This folder contains various demo applications:
in the first cell is calculated recursive calculation of the other cells
is requested.
+- richtext/demo_richtext_utf8: shows working with rich text formatting in cells
+
- rpn_formulas/demo_write_formula: shows some rpn formulas
- searching/demo_search: demonstrates how specific cell content can be
diff --git a/components/fpspreadsheet/examples/other/richtext/demo_richtext_utf8.lpi b/components/fpspreadsheet/examples/other/richtext/demo_richtext_utf8.lpi
new file mode 100644
index 000000000..4d8eb7b9b
--- /dev/null
+++ b/components/fpspreadsheet/examples/other/richtext/demo_richtext_utf8.lpi
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/fpspreadsheet/examples/other/richtext/demo_richtext_utf8.pas b/components/fpspreadsheet/examples/other/richtext/demo_richtext_utf8.pas
new file mode 100644
index 000000000..602cf7663
--- /dev/null
+++ b/components/fpspreadsheet/examples/other/richtext/demo_richtext_utf8.pas
@@ -0,0 +1,63 @@
+program demo_richtext_utf8;
+
+{$mode objfpc}{$H+}
+
+uses
+ SysUtils, fpstypes, fpspreadsheet, xlsxooxml, typinfo;
+
+var
+ book: TsWorkbook;
+ sheet: TsWorksheet;
+ cell: PCell;
+ i: Integer;
+ rtp: TsRichTextParam;
+ fmt: TsCellFormat;
+ dir: String;
+begin
+ dir := ExtractFilePath(ParamStr(0));
+
+ book := TsWorkbook.Create;
+ try
+ // Prepare a worksheet containing rich-text in cell A1
+ sheet := book.AddWorksheet('Sheet');
+ sheet.WriteTextAsHtml(0, 0, 'äöü ÄÖÜ 123');
+
+ // -----------------------------------------
+ // Analyze the fonts used in cell A1
+ //------------------------------------------
+
+ cell := sheet.FindCell(0, 0);
+
+ // Write a "ruler" for counting character positions
+ WriteLn('12345678901234567890');
+ // Write the unformatted cell text
+ WriteLn(sheet.ReadAsText(cell));
+ WriteLn;
+
+ // characters before the first rich-text parameter have the cell font
+ fmt := book.GetCellFormat(cell^.FormatIndex); // get cell format record which contains the font index
+ WriteLn(Format('Initial cell font: #%d (%s)', [fmt.FontIndex, book.GetFontAsString(fmt.FontIndex)]));
+
+ // now write the rich-text parameters
+ for rtp in cell^.RichTextParams do begin
+ WriteLn(Format('Font #%d (%s) starting at character position %d', [
+ rtp.FontIndex,
+ book.GetFontAsString(rtp.FontIndex),
+ rtp.FirstIndex
+ ]));
+ end;
+
+ book.WriteToFile(dir+'test.xlsx', true);
+ finally
+ book.Free;
+ end;
+
+ {$IFDEF MSWindows}
+ if ParamCount = 0 then
+ begin
+ WriteLn('Press ENTER to close...');
+ ReadLn;
+ end;
+ {$ENDIF}
+end.
+
diff --git a/components/fpspreadsheet/examples/other/run_all_demos.bat b/components/fpspreadsheet/examples/other/run_all_demos.bat
index 8db0f94d2..5bdfb283c 100644
--- a/components/fpspreadsheet/examples/other/run_all_demos.bat
+++ b/components/fpspreadsheet/examples/other/run_all_demos.bat
@@ -9,6 +9,7 @@ images\demo_write_images -quit
metadata\demo_metadata -quit
protection\demo_protection -quit
recursive_calculation\demo_recursive_calc -quit
+richtext\demo_richtext_utf8 -quit
rpn_formulas\demo_write_formula -quit
searching\demo_search -quit
sorting\demo_sorting -quit