Basically for cutting and pasting elements: These are all valid commands,
{
var doc = DocumentApp.getActiveDocument();
var body = doc.getBody();
var N = [some number]//the element to copy
var elementVar = body.getChild(N)
if (element.getType = 'LIST_ITEM')
{
body.appendListItem(elementVar.copy());//copy is required
}
//replace XXX_XXX below with one of about a dozen available types.
if (element.getType = 'XXX_XXX')
{
body.appendXxxXxx(elementVar.copy());
}
//etc.
}
But what if you want to insert an element without knowing its type and without having use a bunch of if statements?
{
...
body.appendElement(elementVar.copy());//error
}