AddHeadingCrossRef
function AddHeadingCrossRef(
sRefType: headingRefTo = null,
oParaTo: ApiParagraph = null,
bLink: boolean = true,
bAboveBelow: boolean = false,
): boolean
Description
Adds a heading cross-reference to the current paragraph. Please note that this paragraph must be in the document.
Parameters
The text or numeric value of a heading reference you want to insert.
The heading paragraph 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 "text" and "aboveBelow" sRefType).
Returns
boolean
Try It
var oDocument = Api.GetDocument();
var oNewDocumentStyle = oDocument.GetStyle("Heading 1");
var oParagraph = oDocument.GetElement(0);
oParagraph.SetStyle(oNewDocumentStyle);
oParagraph.AddText("Cross-reference method");
var aHeadingParagraphs = oDocument.GetAllHeadingParagraphs();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("Heading 1 style is applied to the heading ");
oDocument.Push(oParagraph);
oParagraph.AddHeadingCrossRef("text", aHeadingParagraphs[0]);