AnsweredAssumed Answered

WebScript for update file content with a .doc converted file

Question asked by weggyboy on Oct 13, 2007
Latest reply on Nov 12, 2007 by davidc
hi, all!
I´m trying to update the content of an existing HTML file in Alfresco with a new converted file content.
The new content should come from a .doc->HTML  file convertion. All this should happen with a webScript.

I cannot just delete the current file, because it is being referenced outside alfresco. So just the content has to be changed, not the file "last:transformed.html".

this is what I´m using, but it doesn´t work.

// check if it is any .doc file in the folder already
// if there is one, delete it
var nodes = space.childrenByXPath("*[@cm:name='.doc']");
for (var i=0; i < nodes.length; i++)
{
   nodes[i].remove();
}

// check if it is a "last_transformed.html" file in the folder already
var lastfile = space.childByNamePath("last_transformed.html");

if (lastfile != null) {
   transformed = document.transformDocument("text/html", space);
   lastfile.content = transformed.content;
   lastfile.save();
   transformed.remove();
}

Does anybody have any idea, why it doesn´t work? what am I doing wrong?

Outcomes