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 9:38AM
    Can u give me example?
    Thanks.
  • edited 9:38AM
    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 9:38AM
    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 9:38AM
    You should probably set the Stretched property of Rich and its band, also AllowSplit for the band.
  • edited 9:38AM
    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.