cancel
Showing results for 
Search instead for 
Did you mean: 

Modify word document information when content enters a space

jackjm
Champ in-the-making
Champ in-the-making
Hello all,

I was trying to implement a small requirement and I just wanted to know if you had any suggestions about the same:

When a user uploads a document (word or pdf) to a space, is it possible to modify this file at the Rule level, i.e. a rule say; modifyFile.js runs; and adds a line to the first page of the document.

Is this possible? I have mostly worked with content at the JavascriptAPI level and hence my thought first went there; if there are alternatives, I will be glad to consider and explore.

Thank you very much for your time.

Regards
5 REPLIES 5

afaust
Legendary Innovator
Legendary Innovator
Hello,

Alfresco does not provide the necessary JavaScript API to write into Word or PDF files. You may achieve something like this if you implement actions for rules in Java, and make use of thrid party libraries for Word / PDF manipulation (e.g. docx4j for Word 2007 and above).

Regards
Axel

abarisone
Star Contributor
Star Contributor
Hi,
you might also take a look to these Java libraries http://poi.apache.org/ which are very useful when manipulating Microsoft documents.

Regards,
Andrea

santoshbaradwaj
Champ in-the-making
Champ in-the-making
Hi all,
I am also have same requirement i.e when
i am upload the xlxs file into repository. I need to execute one JS  file which reads the xlxs content and stored it in to repository.
If any one have idea on this please help me.

abarisone
Star Contributor
Star Contributor
Hi,
you can create a rule on the folder/folders of your repository which relies on a Java Backed webscript that manipulates your xlsx files.
This webscript should exploit Apache POI libraries to read the xlsx file content and do what you need.
Usually a rule is linked to an action to be performed.
More info here
http://docs.alfresco.com/4.0/index.jsp?topic=%2Fcom.alfresco.enterprise.doc%2Ftasks%2Flibrary-folder...
http://docs.alfresco.com/4.0/topic/com.alfresco.enterprise.doc/concepts/actions.html

Regards,
Andrea

jackjm
Champ in-the-making
Champ in-the-making
Axel, Andrea:

Thank you very much for your assistance. I have something to go on.

I think it will be nice if there was bare-bones no-assumption guide around to create a java backed webscript. I will try to make one if I can wrap my head around all the components.

Best regards