// get information about a current table cell public static string GetInformationAboutCurrentTableCell(Document currentDocument, LayoutTableCell tableCell) { string returnedInformation = "!A TABLE CELL IS SELECTED!\r\n"; string cellText = currentDocument.GetText(currentDocument.CreateRange(tableCell.Range.Start, tableCell.Range.Length - 1)); returnedInformation += String.Format("Cell's content: {0}\r\n", cellText); LayoutTableRow currentRow = tableCell.Parent as LayoutTableRow; if (currentRow == null) { return(returnedInformation); } LayoutTable currentTable = currentRow.Parent as LayoutTable; if (currentTable == null) { return(returnedInformation); } returnedInformation += String.Format("Row index: {0}\r\n", currentTable.TableRows.ToList().IndexOf(currentRow) + 1); for (int i = 0; i < currentRow.TableCells.Count; i++) { if (currentRow.TableCells[i] == tableCell) { returnedInformation += String.Format("Column index: {0}\r\n", i + 1); break; } } returnedInformation += String.Format("\r\n!Table information:\r\n"); returnedInformation += String.Format("Row count: {0}\r\n", currentTable.TableRows.Count); int maxCellsCount = 0; for (int i = 0; i < currentTable.TableRows.Count; i++) { if (currentTable.TableRows[i].TableCells.Count > maxCellsCount) { maxCellsCount = currentTable.TableRows[i].TableCells.Count; } } returnedInformation += String.Format("Column count: {0}\r\n", maxCellsCount); return(returnedInformation); }
protected override void VisitTableRow(LayoutTableRow tableRow) { TryAddElementToCollection(tableRow, ContentDisplayAction.Select, true); base.VisitTableRow(tableRow); }
public override void DrawTableRow(LayoutTableRow tableRow) { base.DrawTableRow(tableRow); HighlightElement(tableRow); }
protected override void VisitTableRow(LayoutTableRow tableRow) { AddTreeNode(tableRow, ContentDisplayAction.Select); base.VisitTableRow(tableRow); }