trichview.support
Re: Are there some pictures ? |
Author |
Message |
Sergey Tkachenko |
Posted: 09/20/2002 20:56:02 Hello, Your function ignores pictures inside tables. Here is an advanced version: uses CRVData; function HasPictures(RVData: TCustomFormattedRVData): Boolean; var i,r,c: Integer; table: TRVTableItemInfo; begin Result := False; for i := 0 to RVData.Items.Count-1 do case RVData.GetItemStyle(i) of rvsPicture, rvsHotpicture, rvsBullet, rvsHotspot: begin Result := True; exit; end; rvsTable: begin table := TRVTableItemInfo(RVData.GetItem(i)); for r := 0 to table.Rows.Count-1 do for c := 0 to table.Rows[r].Count-1 do if table.Cells[r,c]<>nil then begin Result := HasPictures(table.Cells[r,c].GetRVData); if Result then exit; end; end; end; end; Call: res := HasPictures(RichView.RVData); PS: This function ignores one special kind of pictures - pictures-bullets of paragraphs. > Hello, > > Is the function below optimal ? Perhaps it may be useful > for somebody :) > > function ArePicturesInRichView: boolean; > var > i : integer; > itemtype : integer; > begin > Result := False; > for i := 0 to aRichView.ItemCount-1 do > begin > itemtype := aRichView.GetItemStyle(i); > if (itemtype = rvsPicture) or (itemtype = rvsHotSpot) or (itemtype = rvsHotPicture) then > begin > Result := True; > break; > end; > end; > end; > > Regards, > Rafal > > |
Powered by ABC Amber Outlook Express Converter