TRY NEW VERSION

Try now New API BETA

Try out the new view and capabilities of the API documentation

START

AddFootnoteCrossRef

AddFootnoteCrossRef(sRefType, oParaTo, [bLink], [bAboveBelow]) → { boolean }

Adds a footnote cross-reference to the current paragraph. Please note that this paragraph must be in the document.

Parameters:

Name Type Default Description
sRefType footnoteRefTo

The text or numeric value of a footnote reference you want to insert.

oParaTo ApiParagraph

The first paragraph from a footnote to be referred to (must be in the document).

bLink boolean true

Specifies if the reference will be inserted as a hyperlink.

bAboveBelow boolean false

Specifies if the above/below words indicating the position of the reference should be included (don't used with the "aboveBelow" sRefType).

Returns:

Type
boolean

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0); 
oParagraph.AddText("This is just a sample text.");
oDocument.AddFootnote();
var aFootnotesFirstParagraphs = oDocument.GetFootnotesFirstParagraphs();
aFootnotesFirstParagraphs[0].AddText("Footnote 1");
oParagraph = Api.CreateParagraph();
oParagraph.AddText("For more information on previous sentences see footnote ");
oDocument.Push(oParagraph);
oParagraph.AddFootnoteCrossRef("formFootnoteNum", aFootnotesFirstParagraphs[0]);
builder.SaveFile("docx", "AddFootnoteCrossRef.docx");
builder.CloseFile();

Resulting document