rvico TRichView Reference | TRichView

TCustomRichView.DocObjects

Top  Previous  Next

A collection of objects that can be stored in RVF files or streams.

type // defined in RVDocParams unit
  TRVDocObjectCollection = class (TOwnedCollection);
  TRVDocObject = class (TCollectionItem);
property DocObjects: TRVDocObjectCollection;

(introduced in version 17)

TRVDocObjectCollection is a collection of items inherited from TRVDocObject. Items of this collection may have different type.

All published properties of items can be saved and loaded.

If rvfoSaveDocObjects is in RVFOptions, these objects are saved in RVF.

If rvfoLoadDocObjects is in RVFOptions, methods for loading RVF load these objects. Methods for inserting RVF ignore these objects.

Method TRichView.Clear clears DocObjects.

There is one more property allowing to save custom data in RVF: DocProperties.

Example 1

TRVMathDocObject defines default properties for items displaying mathematical expressions.

Example 2

Report Workshop defines TRVReportDocObject having properties DataQuery, HighlightRules and others.

So, for Report Workshop, DocObjects is a way of adding new properties to TRichView without modifying TRichView source code.

Example 3

Define your own classes:

type
  TMyDocObjectA = class (TRVDocObject)
    ...

  published

    property A: String ...

  end;

 

  TMyDocObjectB = class (TRVDocObject)
    ...

  published

    property B: Integer ...

  end;

Adding:

var
  ObjA: TMyDocObjectA;
  ObjB: TMyDocObjectB;
...
  ObjA := TMyDocObjectA.Create(MyRichView.DocObjects);
  ObjA.A := 'Hello';
  ObjB := TMyDocObjectB.Create(MyRichView.DocObjects);
  ObjB.B := 1;

RVF

How to save to RVF: include rvfoSaveDocObjects in RVFOptions.

How to load from RVF: include rvfoLoadDocObjects in RVFOptions.

See also methods for saving RVF (they can save this property):

SaveRVF;

SaveRVFToStream.

See also methods for loading RVF (they can load this property):

LoadRVF;

LoadRVFFromStream.

See also methods of TRichViewEdit for inserting RVF in the caret position (they ignore this property):

InsertRVFFromFileEd;

InsertRVFFromStreamEd;

PasteRVF.

See also methods for inserting RVF (they ignore this property):

InsertRVFFromStream;

AppendRVFFromStream.

See also properties:

RVFOptions.

See also:

Saving and loading RichView documents;

RVF.


TRichView © trichview.com