trichview.com

trichview.support




Text Styles & Save methods


Return to index


Author

Message

Slavi Marinov

Posted: 08/18/2002 15:02:02


Hello again,


I have two problems :

First I want if I have a long text, containing many text styles, and select

the whole text, to apply Bold to the text. So, I cannot use

ApplyTextStyle, because it will discard all the previous changes, i.e. if

there existed underlined and not underlined text, ApplyTextStyle will make

the whole text either underline, or not underline. I also tried the

following loop :


  GetSelectionBounds(crve,stno,enno);

  for i:=stno to enno do

    begin

      RVStylesCount:=RVS.TextStyles.Count;

      tmp := cRVE.GetItemStyle(I);

      IsJump:= RVS.TextStyles[tmp].Jump;

      URL:=PChar(cRVE.GetItemTag(i));

      RVS.AddTextStyle;

      RVS.TextStyles[RVStylesCount]:=RVS.TextStyles[tmp];

      RVS.TextStyles[RVStylesCount].Standard:=False;

      if fsBold in RVS.TextStyles[RVStylesCount].Style

        then


RVS.TextStyles[RVStylesCount].Style:=RVS.TextStyles[RVStylesCount].Style-[fs

Bold]

        else


RVS.TextStyles[RVStylesCount].Style:=RVS.TextStyles[RVStylesCount].Style+[fs

Bold];

      cRVE.GetItem(I).StyleNo:=RVStylesCount;

      if isjump then

        cRVE.SetItemTagEd(i,Integer(StrNew(PChar(URL))));

      Inc(RVStylesCount);

    end;


However this wouldn't work, too, because it changes the text style of items

out of the selection. So, where is the hint? How can I solve this problem?


And secondly, my program throws an exception ( i.e. crashes), when I make a

large table ( for example 2*600) and try to save it to stream. I use the

following to save it to stream


  MS:=nil;

  try

    MS:=TMemoryStream.Create;

    RVE.SaveRVFToStream(MS,false); // This is the row where the program

crashes

    MS.Position:=0;

    SetLength(FRVF,MS.Size);

    MS.ReadBuffer(Pointer(FRVF)^, MS.Size);

  finally

    MS.Free;

  end;


Is there something wrong with my code or just the component doesn't suport

so big tables?


--Slavi









Powered by ABC Amber Outlook Express Converter