i have a table in document.it is first item.(itemno=0).
let's name it table_A.
in cell [2,2] of this table I have another table.Table_B.it is second item in this cell.
I want to add rows to this table_B that is in one of Table_A cells.
how to get cell as richview control? any other possible solution?
what is the best way to do this?
Table in table again
-
- Posts: 25
- Joined: Thu Feb 02, 2006 6:53 am
- Contact:
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Posts: 25
- Joined: Thu Feb 02, 2006 6:53 am
- Contact:
-
- Posts: 25
- Joined: Thu Feb 02, 2006 6:53 am
- Contact:
-
- Posts: 25
- Joined: Thu Feb 02, 2006 6:53 am
- Contact:
-
- Posts: 25
- Joined: Thu Feb 02, 2006 6:53 am
- Contact:
I found a working but very unclear solution.Also I am not it is safe,Sure they must be clear and clever code to do this
Code: Select all
rve.SetSelectionBounds(0,0,0,1);
if not Rve.CanChange or
not rve.GetCurrentItemEx(TRVTableItemInfo, rve2, item) then Exit;
tableX := TRVTableItemInfo(item);
// ItemNo := rve.GetItemNo(tablex);
// rve2.BeginItemModify(ItemNo, Data);
c:=2;
r:=2;
RVData := tablex.Cells[r,c]; // or RichViewEdit1.RVData
RVData := TCustomRVFormattedData(RVData).Edit;
if tablex.getEditedCell(r,c)=nil then exit;
Rve3:= tablex.getEditedCell(r,c);
rve3.SetSelectionBounds(GlobalTableno,0,GlobalTableno,1);
if not Rve3.CanChange or
not rve3.GetCurrentItemEx(TRVTableItemInfo, rve4, item) then Exit;
tablex := TRVTableItemInfo(item);
ItemNo := rve4.GetItemNo(tablex);
RVData := tablex.Cells[tablex.RowCount -2,0]; // or RichViewEdit1.RVData
RVData := TCustomRVFormattedData(RVData).Edit;
rve4.BeginItemModify(ItemNo, Data);
tablex.InsertRowsBelow(1);
......
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
A solution using cell editing is for non-readonly TRichViewEdit.
As for TRichView,
As for TRichView,
Code: Select all
Table_A := RichView1.GetItem(0) as TRVTableItemInfo;
Table_B := Table_A.Cells[2,2].GetRVData.GetItem(1) as TRVTableItemInfo;
Table_B.InsertRows(...);
RichView1.Format;