Jul 16, 2009 at 5:42 PM
Edited Jul 17, 2009 at 5:35 PM
Hello, I am having trouble with the 'index' parameter with regard to paragraphs and tables.
I am attempting to locate a paragraph which contains a certain string and then insert paragraphs or tables before or after it.
It appears that the index returned by Paragraph.startIndex is not the same index used by Document.InsertTable.
When I get a paragraph's startIndex and use that index as a parameter to Document.InsertTable, I get my table inserted at the incorrect location.
It appears that Document.InsertParagraph works as expected and the "NEW PARAGRAPH" gets inserted at the correct place.
Sample code below:
int index = 0;
foreach (Paragraph p in document.Paragraphs)
index = p.startIndex;
document.InsertParagraph(index,"NEW PARAGRAPH", false);
Is it possible that the Document.InserTable index and the Paragraph.StartIndex would not be the same number?