Hi all
I have this major problem. I have loaded the document template with consists
of a TOC and two headings link this
TOC (Page 1)
Heading 1 (Page 2)
Boomark
Heading 3 (Page 2)
What I want is to replace the bookmark between the two heading with alot of
data, which mean that Heading 3 will be on page seven.
Basically I have two problems
1. When I use
object oBookMark = "bookmark";
Bookmark metaBookmark = this.oDoc.Bookmarks.get_Item(ref oBookMark);
Word.Paragraph oPara;
oPara = this.oDoc.Content.Paragraphs.Add(ref metaBookmark.Range);
oPara.Range.Text = "Text1";
oPara.Format.SpaceAfter = 6;
oPara.Range.InsertParagraphBefore();
Word.Paragraph oPara;
oPara = this.oDoc.Content.Paragraphs.Add(ref metaBookmark.Range);
oPara.Range.Text = "Text2";
oPara.Format.SpaceAfter = 6;
oPara.Range.InsertParagraphBefore();
The Output in the document is
Text2
Text1
Where I was expecting Text1 and then Text2. It seems that it is inserting it
in reverse. I have tried using InsertParagraphAfter(), but with a even worse
result.
What am I doing wrong ? Hope for any of you gurus to help.
If you can answer how to update the TOC when done that would be great.
Cheers