how to create a dynamic richview object?

General TRichView support forum. Please post your questions here
Post Reply
li_nummereins
Posts: 12
Joined: Fri Dec 14, 2007 5:46 am

how to create a dynamic richview object?

Post by li_nummereins »

I need to judge that a rvf's stream contains the special tag which I set.So, I create a dynamic richview object and create a instance to do it.But, there are errors in my program.

Code: Select all

function PipisheUtil.judgeRVSTREAMIsNull(rvStream: TStream): Boolean;
var
  tempRV: TRichView;
  tempStream:TStream;
begin
  try
    tempRV := TRichView.Create(nil);
    tempStream:=TMemoryStream.Create;
    tempStream.CopyFrom(rvStream,0);
    tempStream.Position:=0;   //add this ,the IDE show error
    tempRV.LoadRVFFromStream(tempStream);
    tempRV.Format;
    if (tempStream.Size<1) or (judgeRVIsNull(tempRV)) then
    begin
      Result := True;
    end
    else
    begin
      Result := False;
    end;
  finally
    tempRV.Free;
    tempStream.Free;
  end;
end;
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

First, tempRV.Style must be assigned. You can create TRVStyle component in the same procedure.
Next, if you call Format or save RTF, you need to assign tempRV.Parent. Assign some form to it. If you do not want to show tempRV, set tempRV.Visible := False. If you do not have forms in your application, create a form without showing it in the same procedure.
li_nummereins
Posts: 12
Joined: Fri Dec 14, 2007 5:46 am

Thank you very muck

Post by li_nummereins »

I have bean solven it.
Post Reply