Text Range not working as expected
Dear all,
I want to use the automatic numbering for paragraphs to convert an arbitrary integer into a string. The automatic numbering provides a great range of numbering systems (numeric, roman, ...)
In the following script the text range does not behave - although I have used this method in other scripts with success.
//@target framemaker
var KLD_Z = KLD_Z || {}; // global script object
//@include ..\GetText.jsx
KLD_Z.main = function () { // <><><><><><><><><><><><><><><><><><><><><><>
$.bp(true);
var oDoc = app.ActiveDoc, oTL1, oTL2, oTR, sText, oMasterPage, oTxtFrame,
oPgf, PT = 65536;
oMasterPage = oDoc.FirstMasterPageInDoc; // Add a temporary text frame
oTxtFrame = oDoc.NewTextFrame (oMasterPage.PageFrame);
oTxtFrame.Width = 400 * PT;
oPgf = oTxtFrame.FirstPgf;
oPgf.PgfIsAutoNum = 1; // set the value and the numbering format
//oPgf.AutoNumString = "<Indic n=1234>";
oPgf.AutoNumString = "<r=1234>";
oTL1 = new TextLoc (oPgf, 0);
oTL2 = new TextLoc (oPgf, Constants.FV_OBJ_END_OFFSET - 1); // exclude ¶
oTR = new TextRange (oTL1, oTL2);
oDoc.TextSelection = oTR; // → does not select anything
sText = KLD_Z.GetText (oDoc, oTR); // → empty
oTxtFrame.Delete (); // Delete the temp. text frame
return sText;
} //--- end main --------------------------------------------------------
$.writeln("→ " + KLD_Z.main ()); // → empty

