Hello,
I have been searching the forum for information about getting the column index of cell for a bookmark placed into a the column header of a table.
I understand that Word has no conecpt of columns and the bookmark is always placed into a cell with index 0.
Is there a way I can get this required information using Aspose.Words ?
And if not now, are there any plans to provide functionality in the near future?
Cheers,
Robert
Hi Robert,
Thanks for your inquiry. Please see the attached sample document which contains a bookmark inside a table cell. The following code will return the index of that cell in row:
Document doc = new Document(@"C:\Temp\input.docx");
Bookmark bm = doc.Range.Bookmarks["bm"];
Cell cell = (Cell)bm.BookmarkStart.GetAncestor(NodeType.Cell);
int index = cell == null ? -1 : cell.ParentRow.IndexOf(cell);
Console.WriteLine(index);
I hope, this helps.
Best regards,