cancel
Showing results for 
Search instead for 
Did you mean: 

Merging documents from repository

lordzoster
Champ in-the-making
Champ in-the-making
Hallo
I have a repository based on Alfresco 4.2e containing various docx.
I'd need to retrieve some of them (according to their tags) and combine them in a single docx.
Could you point me in any direction?
Thanks in advance
6 REPLIES 6

sasquatch58
Champ in-the-making
Champ in-the-making
Sounds like an option to script this from LibreOffice or Word (depending on your environment/ preferences) using CMIS calls to access Alfresco.
- look for an open the first document
- from this document open and insert/ append the contents of the second document.
- save under a new name and close.

Cheers, Sasquatch

scouil
Star Contributor
Star Contributor
Hi,

As Sasquatch stated, there is no magic out-of-the-box function that would do that.
What you need to do is find a java library that does this, add that lib to alfresco and then call it in your custom java code. You might start looking there. Never tried any though:
http://stackoverflow.com/questions/2494549/is-there-any-java-library-maybe-poi-which-allows-to-merge...

But technically it is possible. We did implement a custom action for a client that would convert all the selected documents into pdfs and then merge all the pdf (alfresco already include the libs and APIs for those 2)
Then we have a pdf that is a merged version of the docs that is available to download.
It might as well be something you want to consider if it fits your requirements.

lordzoster
Champ in-the-making
Champ in-the-making
Thank you.
I was actually considering docx4j.

scouil
Star Contributor
Star Contributor
If you already have the library then appending the documents is just plain java.
What part of the process are you stuck with?

lordzoster
Champ in-the-making
Champ in-the-making
Good question.
I'm stuck with several steps of the process:
- very basic knowledge of Java (just syntax and some principles) - I'm a C# and PHP developer
- no idea of which method to use to programmatically tag and retrieve documents, REST, CMIS, or other, since in every case the documentation I find starts from the far roots of the knowledge and I'm having an hard time in synthesizing valuable informations.

christopheradam
Champ in-the-making
Champ in-the-making
I am a vb developer, and I do have the related methods and codes for <a href="http://www.rasteredge.com/how-to/vb-net-imaging/word-merge-split/">Word merging</a>, including Word document in 2007 and any later version. I see you are C# developer, you can search and use a code converter to convert my vb codes into c#.

Private Sub Combine(source As List(Of BaseDocument), destn As Stream) Implements DOCXDocument.Combine
End Sub
Private Sub Combine(source As List(Of BaseDocument), destn As [String]) Implements DOCXDocument.Combine
End Sub
Private Sub Combine(source As List(Of [String]), destn As Stream) Implements DOCXDocument.Combine
End Sub
Private Sub Combine(source As List(Of [String]), destn As Sting) Implements DOCXDocument.Combine
End Sub