• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to insert a new paragraph?

New Here ,
Feb 16, 2014 Feb 16, 2014

Copy link to clipboard

Copied

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

TOPICS
Scripting

Views

765

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advocate , Feb 16, 2014 Feb 16, 2014

Hi Mark,

You need to use the NewSeriesPgf method of the document object. Then create a TextLoc on the new pgf and add text.

var newPgf = doc.NewSeriesPgf ( oldPgf );

var TLoc = new TextLoc ( newPgf, 0 );

doc.AddText ( TLoc, "This is a new paragraph" );

Good luck

Jang

Votes

Translate

Translate
Advocate ,
Feb 16, 2014 Feb 16, 2014

Copy link to clipboard

Copied

Hi Mark,

You need to use the NewSeriesPgf method of the document object. Then create a TextLoc on the new pgf and add text.

var newPgf = doc.NewSeriesPgf ( oldPgf );

var TLoc = new TextLoc ( newPgf, 0 );

doc.AddText ( TLoc, "This is a new paragraph" );

Good luck

Jang

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 17, 2014 Feb 17, 2014

Copy link to clipboard

Copied

LATEST

Thanks once again Jang!

Mark

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines