how to load text in richobject from delphi

Hello,
Can I load text from external .RTF file in report RICH object form Delphi source?
How to do!?! Please.

Thanks.

Comments

  • edited October 2004
    yep - but due of the (damn) complexity of richtext data, the easiest way to do this is loading the rtf text into a (memory)stream and assign it to the fast report object.
  • edited 12:16PM
    Can u give me example?
    Thanks.
  • edited 12:16PM
    Something like this:
    procedure TForm1.btn1Click(Sender: TObject);
    var
      RichView: TfrxRichView;
      Stream: TMemoryStream;
      Str: string;
    begin
      RichView := TfrxRichView(frxReport1.FindObject('Rich1'));
      if RichView = nil then
        Exit;
      Stream := TMemoryStream.Create;
      try
        Stream.LoadFromFile('Your.rtf');
        SetLength(Str, Stream.Size);
        Stream.Read(Str[1], Stream.Size);
        RichView.RichEdit.Text := Str;
      finally // wrap up
        Stream.Free;
      end;    // try/finally
      if frxReport1.PrepareReport then
        frxReport1.ShowPreparedReport;
    end;
    
  • edited 12:16PM
    Great.... Thank u very much....

    Now I have problem with FastReport maybe is BUG. When load text in RichText object, text show out of range of page. Please see a picture.rich-bug.JPG
  • edited 12:16PM
    You should probably set the Stretched property of Rich and its band, also AllowSplit for the band.
  • edited 12:16PM
    I tried this and it is working well:

    ((TfrxMemoView*)frxReport1->FindObject("Memo1"))->Text = "Hello World";
    ((TfrxRichView*)frxReport1->FindObject("Rich1"))->RichEdit->Text = "Hello World";

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.