Page 1 of 1
Table in table again
Posted: Sun Feb 27, 2011 11:22 am
by delphilord
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?
Posted: Sun Feb 27, 2011 2:58 pm
by Sergey Tkachenko
Is the table in TRichViewEdit or in TRichView?
If in TRichViewEdit, should it be an editing operation (undoable by the user)
Posted: Mon Feb 28, 2011 7:08 am
by delphilord
trichview.
No user action needed.Document build by code,and user can not edit it.
Posted: Mon Feb 28, 2011 8:43 am
by delphilord
I think this way
1-Getting parent (outer) table item - It is easy
2-moving in to cell[2,2] HOW?
3-geting table again
4-add row
is it possible to get inplace editor for desired cell and get table in it?
Posted: Mon Feb 28, 2011 8:49 am
by delphilord
Sorry I don't want to spam. but I can use trichview or read only trichviewedit.
any solution with this two possiblity
Posted: Mon Feb 28, 2011 9:50 am
by delphilord
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);
......
Posted: Mon Feb 28, 2011 4:47 pm
by Sergey Tkachenko
A solution using cell editing is for non-readonly TRichViewEdit.
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;