trichview.support
Re: How can I delete a table without delete it's content ? |
Author |
Message |
Sergey Tkachenko |
Posted: 10/29/2004 20:49:08 Removes the table at the caret position: procedure ConvertTableToText(RichViewEdit: TCustomRichViewEdit); var table: TRVTableItemInfo; rv: TRichView; rve: TCustomRichViewEdit; Stream: TMemoryStream; ItemNo,r,c: Integer; begin if not RichViewEdit.GetCurrentItemEx(TRVTableItemInfo, rve, TCustomRVItemInfo(table)) then exit; rv := TRichView.Create(nil); try rv.Visible := False; rv.Parent := RichViewEdit.Parent; rv.Style := RichViewEdit.Style; rv.RVFTextStylesReadMode := rvf_sIgnore; rv.RVFParaStylesReadMode := rvf_sIgnore; 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 Stream := TMemoryStream.Create; try table.Cells[r,c].GetRVData.SaveRVFToStream(Stream, False, clNone, nil, nil); Stream.Position := 0; rv.InsertRVFFromStream(Stream, rv.ItemCount) finally Stream.Free; end; end; ItemNo := table.GetMyItemNo; Stream := TMemoryStream.Create; try rv.SaveRVFToStream(Stream, False); Stream.Position := 0; rve.SetSelectionBounds(ItemNo, 0, ItemNo, 1); rve.InsertRVFFromStreamEd(Stream); finally Stream.Free; end; finally rv.Free; end; end; |
Powered by ABC Amber Outlook Express Converter