trichview.com

trichview.support




Confused by Merging and styles


Return to index


Author

Message

Colin Messitt

Posted: 06/01/2003 16:50:20


I'm trying to implement a mail-merge type process. Basically the user has

two tabs each with a RichViewEdit on it, the first is where he designs a

template, the second is the result of the merge. (The actual replacement

data is coming via an out-of-process COM server).


To perform the merge I basically take a copy of his template, then for each

record I reload it into his design window, replace the fields, save it to a

stream and then load that stream into the results pane, with a page break on

pages after the first. Basic code is actually -


  repeat

    X2NetMailMerge.FEvents.OnNext(Eof);

    if not Eof then begin

      if FirstPageDone then RichViewEdit2.InsertPageBreak else FirstPageDone

:= True;

      M.Clear;     //Memory Stream

      FillFields(RichViewEdit1.RVData);

      RichViewEdit1.SaveRVFToStream(M, false);

      M.Position := 0;

      MoveCaretToEnd(RichViewEdit2);

      RichViewEdit2.InsertRVFFromStreamEd(M);

    // now put the RTF back in the design editor

      SaverStream.Position := 0;

      RichViewEdit1.LoadRVFFromStream(SaverStream);

    end;

  until Eof;


and it works great, except the replaced fields in the merged output still

have the protection and background color style from the design. How can I

make them no longer protected (so the user could then edit them if he

wanted) and get rid of the background color that indicates they were merge

fields in the design (without losing any other formatting the user might

have applied to them)? Do I need to apply style 0 to those elements somehow?


Thanks,


Colin.






Powered by ABC Amber Outlook Express Converter