trichview.com

trichview.support




Text-Protection


Return to index


Author

Message

CoLT

Posted: 06/19/2005 17:40:49


My Procedure:



PROCEDURE Clip_RTFText(RTFText: STRING; ReadOnly: Boolean);

VAR

  ParaInfo: TParaInfo;

  FontInfo: TFontInfo;

  Stream: TStringStream;

  StartID,EndID,i: Integer;

  NewStyleNo: Integer;

BEGIN


  StartID := frm_print.rv.ItemCount;   //Begin Area

  Stream := TStringStream.Create(RTFText);

  frm_print.rv.LoadRTFFromStream(Stream);

  Stream.Free;

  EndID := frm_print.rv.ItemCount - 1; //End Area


  IF ReadOnly THEN

    FOR i := bitem TO eitem DO

      BEGIN


        //PARA STYLE PROTECTION -------------------------------------

        ParaInfo := TParaInfo.Create(NIL);


        ParaInfo.Assign(frm_print.rvs.ParaStyles[frm_print.rv.getItemPara(i)]);

        ParaInfo.Background.Color := AColor[12];

        ParaInfo.Options := [rvpaoReadOnly, rvpaoStyleProtect, rvpaoDoNotWantReturns];


        NewStyleNo := frm_print.rvs.ParaStyles.FindSuchStyle

          (frm_print.rv.GetItemPara(i), ParaInfo, RVAllParaInfoProperties);


        IF NewStyleNo = -1 THEN

          BEGIN

            frm_print.rvs.ParaStyles.Add;

            NewStyleNo := frm_print.rvs.ParaStyles.Count - 1;

            frm_print.rvs.ParaStyles[NewStyleNo].Assign(ParaInfo);

            frm_print.rvs.ParaStyles[NewStyleNo].Standard := False;

          END;


        ParaInfo.Free;

        frm_print.rv.GetItem(i).ParaNo := NewStyleNo;


        //TEXT STYLE PROTECTION -------------------------------------

        FontInfo := TFontInfo.Create(NIL);


        FontInfo.Assign(frm_print.rvs.TextStyles[frm_print.rv.getItemStyle(i)]);

        FontInfo.Protection := [rvprStyleProtect];


        NewStyleNo := frm_print.rvs.TextStyles.FindSuchStyle

          (frm_print.rv.GetItemStyle(i), FontInfo, RVAllFontInfoProperties);


        IF NewStyleNo = -1 THEN

          BEGIN

            frm_print.rvs.TextStyles.Add;

            NewStyleNo := frm_print.rvs.TextStyles.Count - 1;

            frm_print.rvs.TextStyles[NewStyleNo].Assign(FontInfo);

            frm_print.rvs.TextStyles[NewStyleNo].Standard := False;

          END;


        FontInfo.Free;

        frm_print.rv.GetItem(i).StyleNo := NewStyleNo;

      END;

  frm_print.rv.Format;

END;



Question:


If I choose ReadOnly := true then no picture, will be displayed, which are

in the RTF Text.


Has someone an Idea ?










Powered by ABC Amber Outlook Express Converter