To insert a completely new element, you would use F_ApiNewElement() or F_ApiNewElementInHierarchy(). For some reason, neither of these appear in the PDF bookmarks of the latest FDK reference, but they are described in the text.
You also say something about an "existing" element and "cloning", so I'm not exactly clear on what you want. To copy an existing element, you can select it and use F_ApiCopy() / F_ApiPaste.
One thing I would note, though, is that you are using words that are associated with objects in an object-oriented program. FrameMaker objects are not really the same... they are just things in the session that have properties. There is no real concept of "cloning" or "instantiation" with a FrameMaker object.
adding elements seems to be not so simple. The element object offers only delete and no add method.
How do you use in ES commands from the FDK (like F_ApiNewElement() or F_ApiNewElementInHierarchy())? Unfortunately I could not find anything useful about this. Or is it definitely in ES completely different how to add elements?
Thank you for your any pointer.
NewElement() is a method of an ElementDef object. So to add an element at the current insertion point, you can do something like this:
#target framemaker var doc = app.ActiveDoc; var elementDef = doc.GetNamedElementDef ("p"); var element = elementDef.NewElement (doc.TextSelection.beg);
thank you very much. It works perfectly. It is also doing the validation.