rvico TRichView Reference | TRichView

TCustomRichView.InsertRVFFromStream

Top  Previous  Next

Inserts RVF content from Stream in the position of the document specified as Index (the first inserted item will have this index)

function InsertRVFFromStream(Stream: TStream; Index: Integer): Boolean;

This is the only method of RichView (not RichViewEdit) inserting items in any position.

Index – index of the item, must be in range from 0 to ItemCount. Items of subdocuments (table cells) are not included in the items range of the main document.

Method type: viewerstyle viewer-style.

Setting for RVF loading can be changed in the TRichView component editor.

If style templates are used, and RVFTextStylesReadMode=RVFParaStylesReadMode=rvf_sInsertMerge, and StyleTemplateInsertMode<>rvstimIgnoreSourceStyleTemplates, the method merges style templates from RVF into Style.StyleTemplates, and reads text and paragraph styles according to StyleTemplateInsertMode. The method calls OnStyleTemplatesChange event.

Return value: "Was reading successful?"

hmtoggle_arrow1Example

This example shows how to combine several RVF documents in one.

procedure AddDoc(const FileName: String; rv: TCustomRichView); 

var Stream: TFileStream; 

begin 

  Stream := TFileStream.Create(FileName, fmOpenRead); 

  rv.InsertRVFFromStream(Stream, rv.ItemCount); 

  Stream.Free; 

end

  ... 

  RichView1.Clear

  RichView1.DeleteUnusedStyles(True, True, True); 

  AddDoc('c:\file1.rvf', RichView1); 

  AddDoc('c:\file2.rvf', RichView1); 

  AddDoc('c:\file3.rvf', RichView1); 

  RichView1.Format

If you want to add page breaks between documents, use the following code

procedure AddDoc(const FileName: String; rv: TCustomRichView); 

var Stream: TFileStream; 

  ItemCount: Integer; 

begin 

  ItemCount := rv.ItemCount

  Stream := TFileStream.Create(FileName, fmOpenRead); 

  rv.InsertRVFFromStream(Stream, rv.ItemCount); 

  Stream.Free; 

  if (ItemCount>0and (ItemCount<rv.ItemCountthen 

    rv.PageBreaksBeforeItems[ItemCount] := True; 

end

 

See also properties:

RVFOptions;
RVFWarnings;
RVFTextStylesReadMode (this method type: RVF insertion);
RVFParaStylesReadMode (this method type: RVF insertion).

See also events:

OnRVFImageListNeeded;
OnRVFControlNeeded;
OnRVFPictureNeeded;
OnControlAction (ControlAction=rvcaAfterRVFLoad);
OnStyleTemplatesChange.

See also methods:

AppendRVFFromStream;
LoadRVFFromStream;
LoadRVF;
Format;
FormatTail.

See also methods of TRichViewEdit:

InsertRVFFromStreamEd.
See also:
TRichView component editor;
Saving and loading;
RVF overview.


TRichView © trichview.com