Example: FastAppendText

<< Click to Display Table of Contents >>

Navigation:  Programming > Create text under program control > FastAppendText: Create text with multiple letters >

Example: FastAppendText

var i : Integer;

 

  Table1.DisableControls;

  try

  Table1.First;

  i := 0;

  AllRTFText.BeginUpdate;

  AllRTFText.Clear;

  while not Table1.EOF do

  begin

     WPRichText1.MergeText;

 

    if i=0 then // FIRST RUN

    begin

        AllRTFText.AsString := WPRichText1.AsString;

        AllRTFText.CPPosition := MaxInt; // to end

    end

    else if i>0 then // SUBSEQUENT RUNS

    begin

        AllRTFText.FastAppendText(WPRichText1,true, [wpCreateNewPage]);

    end;

     Application.ProcessMessages;

     Table1.Next;

     inc(i);

  end;

  finally

    AllRTFText.EndUpdate;

    AllRTFText.ReformatAll(true, true);

    Table1.EnableControls;

  end;