How can I reference the same Footnote more than once?
Please see attached document.
Thanks!
Document document = new Document();
document.LoadFromFile(@"F:\testing\doc form\original document\10099.docx");
Section section = document.Sections[0];
//add footnote
Paragraph paragraph = section.Paragraphs[0];
Footnote footnote = paragraph.AppendFootnote(FootnoteType.Footnote);
footnote.TextBody.AddParagraph().AppendText("First");
//insert bookmart includes the footnote
BookmarkStart start = new BookmarkStart(document, "_FootNote1");
BookmarkEnd end = new BookmarkEnd(document, "_FootNote1");
paragraph.ChildObjects.Insert(paragraph.ChildObjects.IndexOf(footnote), start);
paragraph.ChildObjects.Insert(paragraph.ChildObjects.IndexOf(footnote)+1, end);
//add a cross-reference field, and link it to the bookmark
Field Field = new Field(document);
Field.Type = FieldType.FieldNoteRef;
Field.Code = @" NOTEREF _FootNote1 \f \h \* MERGEFORMAT ";
//add it into the place where reference the same footnote.
section.Paragraphs[1].ChildObjects.Add(Field);
FieldMark fieldmark = new FieldMark(document, FieldMarkType.FieldSeparator);
section.Paragraphs[1].ChildObjects.Add(fieldmark);
TextRange tr = new TextRange(document);
tr.Text = "1";
tr.CharacterFormat.SubSuperScript = SubSuperScript.SuperScript;
section.Paragraphs[1].ChildObjects.Add(tr);
FieldMark fieldEnd = new FieldMark(document, FieldMarkType.FieldEnd);
section.Paragraphs[1].ChildObjects.Add(fieldEnd);
document.SaveToFile("sameFootNote10099.docx", FileFormat.Docx);