diff --git a/components/fpspreadsheet/examples/other/defined_names/demo_read_definednames.lpi b/components/fpspreadsheet/examples/other/defined_names/demo_read_definednames.lpi
new file mode 100644
index 000000000..a63129a7b
--- /dev/null
+++ b/components/fpspreadsheet/examples/other/defined_names/demo_read_definednames.lpi
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
diff --git a/components/fpspreadsheet/examples/other/defined_names/demo_read_definednames.lpr b/components/fpspreadsheet/examples/other/defined_names/demo_read_definednames.lpr
new file mode 100644
index 000000000..ea5ef7c47
--- /dev/null
+++ b/components/fpspreadsheet/examples/other/defined_names/demo_read_definednames.lpr
@@ -0,0 +1,54 @@
+program demo_read_definednames;
+{.$DEFINE ODS}
+uses
+ fpspreadsheet, fpsTypes, fpsClasses, fpsUtils, fpsAllFormats;
+var
+ wb: TsWorkbook;
+ ws: TsWorksheet;
+ cell: PCell;
+ i: Integer;
+ fn: String;
+begin
+ {$IFDEF ODS}
+ fn := 'test_defnames.ods';
+ {$ELSE}
+ fn := 'test_defnames.xlsx';
+ {$ENDIF}
+
+ wb := TsWorkbook.Create;
+ try
+ wb.Options := [boAutoCalc, boReadFormulas];
+
+ wb.ReadFromFile(fn);
+ ws := wb.GetFirstWorksheet;
+
+ WriteLn('FILE: ', fn, LineEnding);
+
+ WriteLn('DEFINED NAMES');
+ for i := 0 to wb.DefinedNames.Count-1 do
+ WriteLn(wb.DefinedNames[i].Name, ' --> ', wb.DefinedNames[i].RangeAsString(wb));
+
+ WriteLn;
+ WriteLn('CELLS');
+ for cell in ws.Cells do
+ begin
+ Write(GetCellString(cell^.Row, cell^.Col), ' --> ', ws.ReadAsText(cell));
+ if HasFormula(cell) then
+ Write(' (formula: ', ws.GetFormula(cell)^.Text, ')');
+ WriteLn;
+ end;
+
+ finally
+ wb.Free;
+ end;
+
+ if ParamCount = 0 then
+ begin
+ {$IFDEF MSWINDOWS}
+ WriteLn('Press [ENTER] to quit...');
+ ReadLn;
+ {$ENDIF}
+ end;
+
+end.
+
diff --git a/components/fpspreadsheet/examples/other/defined_names/demo_write_definednames.lpi b/components/fpspreadsheet/examples/other/defined_names/demo_write_definednames.lpi
new file mode 100644
index 000000000..d8086629e
--- /dev/null
+++ b/components/fpspreadsheet/examples/other/defined_names/demo_write_definednames.lpi
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
diff --git a/components/fpspreadsheet/examples/other/defined_names/demo_write_definednames.lpr b/components/fpspreadsheet/examples/other/defined_names/demo_write_definednames.lpr
new file mode 100644
index 000000000..e0ca53083
--- /dev/null
+++ b/components/fpspreadsheet/examples/other/defined_names/demo_write_definednames.lpr
@@ -0,0 +1,31 @@
+program demo_write_definednames;
+uses
+ fpspreadsheet, fpsTypes, fpsUtils, fpsClasses, fpsAllFormats;
+var
+ wb: TsWorkbook;
+ ws: TsWorksheet;
+ wsIdx: Integer;
+ i: Integer;
+begin
+ wb := TsWorkbook.Create;
+ try
+ wb.Options := [boAutoCalc];
+ ws := wb.AddWorksheet('Test');
+ wsIdx := wb.GetWorksheetIndex(ws);
+
+ wb.DefinedNames.Add('distance', wsIdx, 1, 2);
+ ws.WriteText(1, 1, 'distance'); ws.WriteNumber(1, 2, 120); ws.WriteFormula(1, 3, '=distance');
+
+ ws.WriteText(2, 1, 'time'); ws.WriteNumber(2, 2, 60);
+ wb.DefinedNames.Add('time', wsIdx, 2, 2);
+
+ wb.DefinedNames.Add('speed', wsIdx, 3, 2);
+ ws.WriteText(3, 1, 'speed'); ws.WriteFormula(3, 2, '=distance/time');
+
+ wb.WriteToFile('test_defnames.xlsx', true);
+ wb.WriteToFile('test_defnames.ods', true);
+ finally
+ wb.Free;
+ end;
+end.
+
diff --git a/components/fpspreadsheet/examples/other/other_demos.lpg b/components/fpspreadsheet/examples/other/other_demos.lpg
index 57dd7b7ed..73598e35c 100644
--- a/components/fpspreadsheet/examples/other/other_demos.lpg
+++ b/components/fpspreadsheet/examples/other/other_demos.lpg
@@ -68,6 +68,11 @@
+
+
+
+
+
diff --git a/components/fpspreadsheet/examples/other/readme.txt b/components/fpspreadsheet/examples/other/readme.txt
index ab22ec493..d32b86619 100644
--- a/components/fpspreadsheet/examples/other/readme.txt
+++ b/components/fpspreadsheet/examples/other/readme.txt
@@ -42,6 +42,9 @@ This folder contains various demo applications:
can be registered in fpspreadsheet for usage in rpn formulas. The example
covers some financial functions.
+- defined_names: shows how "defined names" (named cells) can be used in
+ FPSpreadsheet. Also in formulas.
+
- virtual_mode/demo_virtualmode_writing: demonstrates how the virtual mode
of the workbook can be used to create huge spreadsheet files.
diff --git a/components/fpspreadsheet/examples/other/run_all_demos.bat b/components/fpspreadsheet/examples/other/run_all_demos.bat
index 532f265e4..d2cfa1d02 100644
--- a/components/fpspreadsheet/examples/other/run_all_demos.bat
+++ b/components/fpspreadsheet/examples/other/run_all_demos.bat
@@ -1,6 +1,7 @@
cell_formats\demo_write_formatting -quit
colors\demo_write_colors -quit
conditional_formatting\demo_conditional_formatting -quit
+defined_names\demo_write_definednames -quit
expression_parser\demo_expression_parser -quit
frozen_rowscols\demo_frozen_rows_cols -quit
header_footer_images\demo_write_headerfooter_images -quit