Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Rich Text

edited June 2004 in General
I have a delphi App which is a RichText Editor. I am trying to use a
ppReport Component as a print previewer.
I put a RichText in the Header Band and set it's stretch Property to True.
Just before I Print the report use the following:

ReportRichText.RichText := FormRichText.Text;

However when the preview form shows up all the formatting is gone and I have
just the plain text. How do I keep the Formatting?

S

Comments

  • edited June 2004
    ------------------------------------------------
    Tech Tip: Copy RTF data from TRichEd to TppRichText
    ------------------------------------------------

    You can copy RTF data from Delphi's TRichEd to ReportBuilder's TppRichText
    control by using an intermediate memory stream:



    var
    lRTFStream: TMemoryStream;

    begin

    {create temp memory stream}
    lRTFStream := TMemoryStream.Create;

    {save the TRichEd's rtf data to the memory stream}
    RichEdit1.Lines.SaveToStream(lRTFStream);

    {load the rtf stream to the TppRichText}
    lRTFStream.position := 0;
    ppRichText1.LoadFromRTFStream(lRTFStream);

    {free the memory stream}
    lRTFStream.Free;


    end;


    Note: An alternative method would be to use RichEdit1.Lines.SaveToFile and
    TppRichText.LoadFromFile.



    --
    Tech Support mailto:support@digital-metaphors.com
    Digital Metaphors http://www.digital-metaphors.com



    --

    Nard Moseley
    Digital Metaphors Corporation
    www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited June 2004
    I use the SelText

    ppRichText1.SelText:= aStringWithRtfFormat;
  • edited June 2004

    Excellent suggestion. :)

    --

    Nard Moseley
    Digital Metaphors Corporation
    www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.