trichview.support
Re: Merging table cells |
Author |
Message |
Sergey Tkachenko |
Posted: 09/10/2004 13:06:48 Sorry for delay. There are two solutions possible, depending on if this operation should be undoable or not. If undoable, the code is below: procedure MergeParagraphs(rve: TCustomRichViewEdit); var i: Integer; begin for i := rve.ItemCount-1 downto 1 do if rve.IsParaStart(i) and (rve.GetItemStyle(i)<>rvsListMarker) then begin rve.SetSelectionBounds(i, rve.GetOffsBeforeItem(i), i, rve.GetOffsBeforeItem(i)); SendMessage(rve.Handle, WM_KEYDOWN, VK_BACK, 0); end; end; procedure TForm3.Button1Click(Sender: TObject); var table: TRVTableItemInfo; ItemNo, Data: Integer; rve: TCustomRichViewEdit; r, c, cs, rs: Integer; begin if RichViewEdit1.GetCurrentItemEx(TRVTableItemInfo, rve, TCustomRVItemInfo(table)) then if table.CanMergeSelectedCells(True) then begin ItemNo := table.GetMyItemNo; SendMessage(rve.Handle, WM_SETREDRAW, 0, 0); rve.BeginUndoGroup(rvutModifyItem); rve.SetUndoGroupMode(True); rve.BeginItemModify(ItemNo, Data); table.GetNormalizedSelectionBounds(True, r,c, cs, rs); table.MergeSelectedCells(True); table.DeleteEmptyRows; table.DeleteEmptyCols; rve.EndItemModify(ItemNo, Data); rve.SetUndoGroupMode(False); rve.Change; table.EditCell(r,c); MergeParagraphs(RichViewEdit1.TopLevelEditor); table.Select(r,c,0,0); SendMessage(rve.Handle, WM_SETREDRAW, 1, 0); rve.Invalidate; end; end; > I understand. Now, how can I merge n cells and merge also the paragraphs? |
Powered by ABC Amber Outlook Express Converter