0

When updating a document in alfresco's repository, it gets versioned on each check in, am looking for a way to dynamically include a version history table into one of my document's pages.

Exactly like the 'Version history' shown in the document details inside Share, is there any way to let alfresco automatically update my document to insert that part ? or in a simpler way, is there anyway to automatically put the version history table inside my deliverable documents ?

zfou
  • 891
  • 1
  • 10
  • 33
  • Similar to the one shown in the Document Details sidebar in Share? – Gagravarr Nov 18 '13 at 13:10
  • 1
    Could you pls specify your question in more detail? What's your problem, what did you tried, where are you struggling? You should not ask for a ready meal here ;-) – alfrescian Nov 18 '13 at 17:03
  • Any chance you're using Alfresco 4.2? Only it's a lot lot easier in 4.2 than earlier versions, thank to the Share Modularisation work included in 4.2 – Gagravarr Nov 19 '13 at 15:25
  • Yes, am with Alfresco4.2, how can it be done so ? – zfou Nov 19 '13 at 15:53
  • It sounds to me like you want to append a version history table to the end of your documents when they are checked in. You have the Alfresco API that lets you fetch the version history. And there are libraries that let you manipulate binary files (like office documents). So you have everything you need. If you try it and you have problems, come back and give us specifics. – Jeff Potts Nov 22 '13 at 21:27

1 Answers1

0

Oke for this to work you'll need JAVA knowledge to inject content in a document. BTW this is a very old implementation so there could be nicer/faster ways to do this.

What we did was the following: All the code is already in the Openoffice libraries within Alfresco. e.g. take a look at this library; openoffice-unoil-3.1.0.jar

Created a custom Action which takes as input a node.

  1. Use XComponentLoader to get the current connection
  2. Use XComponent to get the file (we copied the content to a JAVA tempFile)
  3. Use XBookmarksSupplier to get the current bookmarks in Word (so in this case, set a bookmark for the version history table)
  4. When looping through the bookmarks, get the Anchor. Within this object you can setString and then set your table string. I'm not sure how to set a table in this String. But it won't be fun if everything is known ;). Here is a bit Java code.
  5. In the end use XStorable to store the file by using it's url

Good luck!

Community
  • 1
  • 1
Tahir Malik
  • 6,623
  • 15
  • 22