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

Trying to Copy InfoPower TwwDBRichEdit to RB RichText

edited December 2003 in General
I have tried numerous methods of copying the contents of IP's TwwDBRichEdit
including BOLD, ITALICS into a RB RichText component.

I followed the steps in the RB Readme.doc: ReportBuilder InfoPower RichEdit
Support for Delphi 7, and I still cannot copy from IP to RB.

I tried using the CopyRTF procedure (written by Mike Orriss), but it uses
TRichEdit components. I need to copy from TwwDBRichEdit to RB's RichText.

Knowing that this can be done, can anyone provide code for this?

TVM-IA (thx very much - in advance) !!!

--patrick

Comments

  • edited December 2003
    Hi Patrick,

    ------------------------------------------------
    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.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2003
    Both methods work, however RB loses the BOLD, ITALIC, UNDERLINE, etc.

    When copying to a temp file: RichEdit1.Lines.SaveToFile('C:\TEMP.RTF'), and
    when you open that file in Word, all of the
    BOLD, ITALIC, UNDERLINE are there. RB is not copying the BOLD, ITALIC,
    UNDERLINE when calling TppRichText.LoadFromFile('C:\TEMP.RTF');



    --patrick

  • edited December 2003
    CORRECTION to my last post. This DOES WORK - provided you preview in RB's
    standard previewer.

    By default, I use TExtraDevices to copy the report to a PDF, and the I
    preview all reports in AcrobatReader. When you preview in pdf, you lose the
    formats in the rtf/RichText.

    thx--patrick



This discussion has been closed.