Hi,
Hi
Thanks for your request. You can try inserting a Bookmark in a table, which you would like to find. Then you can use the following code to find the table:
Document doc = new Document("in.doc");
// Get bookmark
Bookmark bk = doc.Range.Bookmarks["bookmark"];
if (bk != null)
{
// Get table, where bookmark is located.
Node table = bk.BookmarkStart.GetAncestor(NodeType.Table);
if (table != null)
// Work with table.
}
Best regards,
Hmm - that doesn’t really tell me which Table a Run is part of…
Hi Mark,
Please see the code below which should achieve what you are looking for.
// All tables in the document.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
NodeCollection tableNodes = doc.GetChildNodes(NodeType.Table, true);
foreach (Run run in doc.GetChildNodes(NodeType.Run, true))
{
Table parentTable = (Table)run.GetAncestor(NodeType.Table);
// Find and compare the ID of the table which contains this run.
if (tableNodes.IndexOf(parentTable) < 8)
run.Font.Size = 12;
else
run.Font.Size = 10;
}
Thanks,
Also, is appears you can now access the forum. Were you able to solve your browser error on your side?
Thanks,