static void Main(string[] args)
{
//Load Document from disk
Document document = new Document();
document.LoadFromFile("Sample.docx");
//Insert Bookmark
Section section = document.Sections[0];
section.Paragraphs[3].AppendBookmarkStart("Spire");
section.Paragraphs[4].AppendBookmarkEnd("Spire");
//Move to bookmark
BookmarksNavigator bn = new BookmarksNavigator(document);
bn.MoveToBookmark("Spire", true, true);
Section section0 = document.AddSection();
Paragraph paragraph = section0.AddParagraph();
//Create Table
Table table=CreateTable(section0);
//Insert the table at the position of bookmark
bn.InsertTable(table);
document.Sections.Remove(section0);
document.SaveToFile("result.docx", FileFormat.Docx);
}
private static Table CreateTable(Section section)
{
Table table=section.AddTable(true);
table.ResetCells(3, 3);
return table;
}