trichview.support
Getting table name without knowing table parent |
Author |
Message |
Glenn |
Posted: 04/23/2005 17:35:41 I set up a table inside a table like this: tempTable := TRVTableItemInfo.CreateEx(2, 2, RichViewEdit.RVData); RichViewEdit.InsertItem('outer table', tempTable); tempTable2 := TRVTableItemInfo.CreateEx(2, 2, tempTable.Cells[0, 1]); tempTable.Cells[0, 1].AddItem('inner table', tempTable2); and then given the currently active in-place editor, I want to find out the name of the table being edited, the following code works for the outer table but not the inner table: var table: TRVTableItemInfo; document: TRVTableCellData; parentDocument: TCustomRVFormattedData; tablename: string; begin document := (AEditor as TRVTableInplaceEdit).FCell as TRVTableCellData; parentDocument := document.GetAbsoluteParentData.GetSourceRVData as TCustomRVFormattedData; table := document.GetTable; tableName := parentDocument.GetItemText(table.GetMyItemNo); What happens when you try to use this code on the inner table is that parentDocument.ItemCount is 0 and you get a index out of range error if you try to access GetItemText(table.GetMyItemNo). But if I add text items to parentDocument they are correctly added to the cell that contains the inner table, so I am confused as to how it can have an itemcount of 0. |
Powered by ABC Amber Outlook Express Converter