trichview.com

trichview.support




Deleting all bitmaps in a document (TDBRichViewEdit)


Return to index


Author

Message

Tavo

Posted: 10/31/2002 2:12:11


Hello:


Mi application is storing documents in a TBlobField, and there are

another field (a TIntegerField) with an ID of "model of letter". Each

model is linked with a footer and a Header.

The purpose of my code is not store the header (with bmp of company

logo, etc) in each document.


I have implemented "Header&Footer" features recently. Then, there is

very much documents already inserted in the Database with embedded bitmaps.


I'm trying to write a code that it delete all bitmaps in documents. But

not work:


My first attempt:


procedure DeleteBMPS(RVData: TCustomRVData);

var i: Integer;

begin

      for i := 0 to RVData.Items.Count-1 do begin

         if RVData.GetItemStyle(i)=rvsPicture then begin

            RVData.DeleteItems(i,1) ;

         end;

      end;

end ;


This not work, because the Items.Count property change in each delete.

I've get a "List index out of bounds (n)"


My second attempt:


procedure DeleteBMPS(RVData: TCustomRVData);

var i: Integer;

begin


      i := 0 ;

      while i < RVData.Items.Count do begin

         if RVData.GetItemStyle(i)=rvsPicture then

            RVData.DeleteItems(i,1)

         else Inc(i) ;

      end ;


end;


This work fine in a TRichView or TRichViewEdit, but in a

TDBRichViewEdit, I've get a error "List index out of bounds (n)"

?Same error? when I make a Post in the TClientDataSet. I've tried a call

to DeleteUnusedStyles after DeleteBMPS() but no result.


I've debug the code and I get the error in

TRVEditRVData.BuildJumpsCoords() in CustomRichViewEdit.SetReadOnly()

( this data serves as something? )


I know that I am making something bad, but do not know what.


Thanks in advance for the help

Tavo.













Powered by ABC Amber Outlook Express Converter