Skip to main content
darkkilltec
Participating Frequently
December 10, 2014
Answered

Create new Unanchored Frame not working?

  • December 10, 2014
  • 1 reply
  • 789 views

Hi everyone.

What i am trying is creating an empty frame for graphics.

i´m using Extendscript for this purpose. I can create Frames with Graphic. but no empty Frames.

I Tried following code:

                                        

frame = doc.NewGraphicObject (Constants.FO_AnchoredFrame, doc.TextSelection);               

frame = doc.NewGraphicObject (Constants.FO_UnanchoredFrame, doc.TextSelection);               

frame = doc.NewUnanchoredFrame (doc.TextSelection);

        

None of those is creating an empty Frame. I have an unstructered Document but tried this with structered documents too.

I tried them one by one, and now i am out of options. I don´t have a clue why this is not working.

I´m using Framemaker 12.

Hope somebody knows what i´m missing.

This topic has been closed for replies.
Correct answer Russ Ward

Rick is correct for the unanchored objects, but one point of clarification for the anchored frame... you are using the wrong method for that. You should use the following, noting that this method requires a text location, not a graphic object:

var frame = doc.NewAnchoredAFrame(doc.TextSelection.beg);

Also, if you want to put an unanchored object on the page with the current insertion point, this might work too, although please note that I did not test this:

var frame = doc.NewUnanchoredFrame(doc.TextSelection.beg.InTextFrame);

Russ

1 reply

frameexpert
Community Expert
Community Expert
December 10, 2014

For an unanchored frame, you have to specify a parent object, not a text location.

#target framemaker

var doc = app.ActiveDoc;

var page = doc.FirstBodyPageInDoc;

var frame = doc.NewUnanchoredFrame (page.PageFrame);

This will create a small frame at the upper-left corner of the first page of the active document. Please let me know if you have any questions or comments. -Rick

www.frameexpert.com
darkkilltec
Participating Frequently
December 10, 2014

And how would i Inser the Frame at the current selection?