Wow, Klaus, again capitalisation hit me!
«try currPgf.Name instead of currPgf.name»
This works as intended.
I have not yet found a clear list of syntax rules - and there are differences between JS and ES object and methods ...
This is the final solution to my problem which is not just re-apply the current ¶-format:
- Although the paste operation inserts something with different format, the information field bottom left does not indicate a modified ¶-format. There is no * after the format-name.
- After inserting (replacing) the temp. citation by a biblographic record the ¶ shows mixed fonts and sizes. Only part of the ¶ is selected (that part where the found temp. citation was).
What I ned to do in my case is this:
- Get only font-family and font-size from the catalogue
- Apply only these properties to the completely selected ¶
function ReApplyFontAndSize (oDoc, tRange) {
oDoc.TextSelection = tRange; // current selection is only part of ¶
var currPgf = oDoc.TextSelection.beg.obj;
var pgfFmt = 0, propsPgf;
pgfFmt = oDoc.GetNamedPgfFmt(currPgf.Name); // get properties from catalogue
if (!pgfFmt.ObjectValid()) { // pgf fmt is not in catalogue
return;
}
propsPgf = AllocatePropVals(2); // for font-family and -size
propsCatlg = pgfFmt.GetProps(); // get properties from catalogue
j = GetPropIndex(propsCatlg, Constants.FP_FontFamily);
propsPgf[0] = propsCatlg ;
j = GetPropIndex(propsCatlg, Constants.FP_FontSize);
propsPgf[1] = propsCatlg ;
tRange.beg.obj = currPgf; // select the whole paragraph
tRange.beg.offset = 0;
tRange.end.obj = currPgf;
tRange.end.offset = Constants.FV_OBJ_END_OFFSET;
oDoc.TextSelection = tRange;
oDoc.SetTextProps (tRange, propsPgf); // apply font family and size
} // --- end ReApplyFontAndSize
This may be streamlined - but it does what it should.