2 Replies Latest reply on Feb 17, 2014 4:05 PM by gisteppen

    How to insert a new paragraph?

    gisteppen

      I want to insert a paragraph with something like a line, to separate hunks of text I am pasting into a document. I see no obvious way to do this. I see no AddPgf() function, for example. And no Doc.AddPgf() or whatever.

       

      I can add text in an existing paragraph with this:

       

      function test1() {

      var doc = app.ActiveDoc;

      var t1 = new TextLoc();

      var firstPgf = doc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf;

      t1.obj = firstPgf;

      t1.offset = 0;

      doc.AddText (t1, "Hello");

      }

       

      I had the idea that I would do AddText() at the very end of a paragraph to create a new paragraph, but this code crashes FrameMaker (only difference from above is Constants.FV_OBJ_END_OFFSET):

       

      function test1() {

      var doc = app.ActiveDoc;

      var t1 = new TextLoc();

      var firstPgf = doc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf;

      t1.obj = firstPgf;

      t1.offset = Constants.FV_OBJ_END_OFFSET;

      doc.AddText (t1, "Hello");

      }

       

      Thanks,

      Mark