How can we apply track revisions?

Hi Aspose Support Team,

We have support currently with us, and we have an issue with the applyTrackRevisions when we are going to create the document but when the sentence new Document(bain) it’s executed we get the next error:

com.aspose.words.UnsupportedFileFormatException: Unknown file format.
at com.aspose.words.Document.ëY(Unknown Source)
at com.aspose.words.Document.ëZ(Unknown Source)
at com.aspose.words.Document.(Unknown Source)
at com.aspose.words.Document.(Unknown Source)
at com.aspose.words.Document.(Unknown Source)

So, how can we apply track revisions and get the document ready to be edited?

Below is written the code:

public static boolean applyTrackRevisions(InputStream ins, String extOrigen, OutputStream ous, boolean activo) throws Exception{
byte [] bins = IOUtils.getStreamAsByteArray(ins);
ByteArrayInputStream bain = new ByteArrayInputStream(bins);
Document doc = new Document(bain);
doc.setTrackRevisions(activo);
if(“doc”.equalsIgnoreCase(extOrigen))
doc.save(ous, SaveFormat.DOC);
else if(“doc”.equalsIgnoreCase(extOrigen))
doc.save(ous, SaveFormat.DOCX);
return true;
}


best regrads,

Thanks in advance.

Ing. David Cortina

Hi David,


Thanks for your inquiry. You can set Document.TrackRevisions property to true if changes are tracked when this document is edited in Microsoft Word. However, setting this option only instructs Microsoft Word whether the track changes is turned on or off. This property has no effect on changes to the document that you make programmatically via Aspose.Words. The changes that you make via Aspose.Words are never tracked as revisions. Also, please read the following article for more details:
http://www.aspose.com/docs/display/wordsjava/Manage+Tracking+Changes

Secondly, please attach your input document, you’re getting UnsupportedFileFormatException with, here for testing. I will investigate the issue on my side and provide you more information.

Best regards,

Hi awais.hafeez

Thanks for your answer. There is attached the document with which I realize the test.

Best regards.

Ing. David Cortina

Hi David,

Thanks for your inquiry. While using the latest version of Aspose.Words for .Java i.e. 13.9.0, I was unable to reproduce this exception on my side. I would suggest you please upgrade to the latest version of Aspose.Words. You can download it from the following link:
http://www.aspose.com/community/files/72/java-components/aspose.words-for-java/default.aspx

I hope, this helps.

Best regards,