Hi Jean, Jean Couteau wrote:
Dear all,
I am trying to create a document from a page, with a template and an object attached, but without having to quit the said page.
I generate fine the new document and the object with the values i want for the properties, but i did not succeed in putting text in the document, i tried using $newDoc.setDefaultTemplate and $newDoc.insertText but no success at all.
I post here my piece of code, any hint will be appreciated (after a few hours on this, i am a bit lost):
#if($createDomain!="") #set($newDoc=$xwiki.createDocument()) #set($newName="Project."+$newDomainId) $newDoc.rename($newName)
$newDoc.insertText("#includeForm(\"XWiki.DomainClassSheet\")","")
See http://tinyurl.com/c743xu . Maybe this will work: $newDoc.setContent("#includeForm(\"XWiki.DomainClassSheet\")") Hope this helps, Marius
#set($newDoc=$xwiki.getDocument($newName)) #set($newObject=$newDoc.newObject("XWiki.DomainClass")) $newObject.set("id",$newDomainId) $newObject.set("name",$createDomain) $newDoc.save() #end
Jean