Apr 1, 2012 at 10:20 PM
Edited Apr 1, 2012 at 10:21 PM
I've only just picked up DocX and started using it so I'm certainly no expert, but when I've had to do something similar I've been able to use one of two approaches:
1) Find some placeholder text in the document and navigate from there
// add the details to the table - find the right table
foreach (var table in docx.Tables)
// the table has the placeholder text in the first cell of the first non-header row
if (table.Rows.Count > 1 && table.Rows.Cells.Paragraphs.Text == "@@fulltitlename")
// you can now do stuff with 'table'
2) Rely on your knowledge of the document structure without relying on placeholders
// find the row to we want
var theRow = docx.tables.Rows;
// do some things to 'theRow'
I find it useful to set a breakpoint in my code and explore the docx object to get a feel for the document structure.
If you find a better way let me know :)