Hi
Thanks for your inquiry. This “magic number” is name of auto generated bookmark that is created surround footnote. This looks like the following.
BookmarkStart
Footnote
BookmarkEnd
You can try to achieve this using the following code.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// write some text
builder.Write("Some text is added.");
// insert footnote
Footnote footnote = builder.InsertFootnote(FootnoteType.Footnote, "Footnote text.");
// create name
string name = String.Format("_Ref{0}",footnote.GetHashCode().ToString());
// create bookmark
BookmarkStart start = new BookmarkStart(doc, name);
BookmarkEnd end = new BookmarkEnd(doc, name);
// insert bookmark start before footnote
footnote.ParentParagraph.InsertBefore(start, footnote);
// insert bookmark end after footnote
footnote.ParentParagraph.InsertAfter(end, footnote);
// insert NOTEREF field (YOu should update this field in MS WORD)
builder.InsertField(String.Format(@"NOTEREF {0} \h", name), "1");
// save document
doc.Save(@"407_105812_ategen\out.doc");
But there in one problem. Aspose.Words doesn’t update NOTEREF
fields. That’s why you should update an inserted field manually in MS Word.
I hope that this information will help you. Please let me know if you would like to know something else.
Best regards.