Do you want to: Report a bug
Document Server version:
Additional information:
I have been trying to insert some text at current cursor position, i am using insertContent method to add text to paragraph and i need to be able to get the range or select the text. i am not able to get the element range or not able to select. I am in requirement of creating a bookmark programatically i.e adding text in document and then apply bookmark. I am using the code in plugin & macros.
(function()
{
const oDocument = Api.GetDocument();
const oParagraph = Api.CreateParagraph();
const oRun = Api.CreateRun();
debugger;
let oVariableName = `{{aaaa}}`;
oRun.AddText(oVariableName);
oParagraph.AddElement(oRun);
oDocument.InsertContent([oParagraph], true);
const paraSelected = oParagraph.Select();
console.log(paraSelected);
if (!paraSelected) {
const runSelected = oRun.Select();
console.log('RUN selected', runSelected);
}
})();
on fetching paragraph methods such as GetRange
, it throws error and returns null for GetPosInParent
and Select
doesn’t work either. How do we get the element position for newly created elementsin plugins or macros
Error for GetRange
method