Free Support Forum - aspose.com

Aspose License not working for Aspose.Words for Java 10.1.0

Hi,

I got the License for Aspose from our clients to work upon developing a POC.

When i tested with that, the documents(docx) are getting delivered properly when iam using the jar version downlaoded from under this folder(Aspose.Words for Java 10.4.0).

But the client states that they procured the license for the jar version Aspose.Words for Java 10.1.0.

But testing with the 10.1.0 version jar, the License is not getting recognized and in the document iam seeing the water marks stating that its an evalution version.

Can you please help me out how can resolve this problem

Thanks

Raghav

Hello

Thanks for your request. Please make sure that you applied the license as described here:
http://www.aspose.com/documentation/java-components/aspose.words-for-java/applying-a-license.html

http://www.aspose.com/documentation/java-components/aspose.words-for-java/when-to-apply-a-license.html

Aspose license carries a one-year subscription for free upgrades to any new versions or fixes that come out during this time.

The license will work unlimited time with versions that comes out before license expiration time.

Also, may I ask you, why you are using 10.1.0 version of Aspose.Words instead of the latest version.

Best regards,

Hi Andrey,

Thanks for your reply.

We have followed the same process you suggested for applying license, but that has been done from the client end.

To answer your question, It has been suggested by the client to use 10.1.0 version.

But as we faced this problem, we tried using the latest version.

Now we got a new and intresting issue. The testing with latest version jar in local environment is working as expected, but when we treid implementing the same latest jar in dev environment failed throwing an error while saving the document.

Below is the error trace. Iam trying to merge 2 docx documents using Aspose.

description = : MERGE_ERROR:Invalid save format requested.:Exception :java.lang.IllegalArgumentException:Invalid save format requested.[Thrd:pool-2-thread-1];stack=java.lang.IllegalArgumentException: Invalid save format requested.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

at com.aspose.words.SaveOptions.createSaveOptions(SaveOptions.java:152)

at com.aspose.words.Document.h(Document.java:764)

at com.aspose.words.Document.save(Document.java:755)

And below is the point where exception occured.

mergedDocumentObj.save(ByteArrayOutputStream,SaveFormat.DOCX)

And below is doubt which got into my mind by seeing this.

Since in Dev environment we tested with Old Jar version earlier and now changing it to new jar version, there might be some references to old version which is causing this issue. Correct me if iam wrong. And please provide your suggestion on this.

Hi

Thanks for your inquiry. Could you please attach your document and code here for testing? I will check the problem on my side and provide you more information.

Best regards,

Andrey,

I had some constraints from client side in sharing the code, for that iam seeking permission from them.

But mean while can you please suggest the possible solutions for solving this problem, so that i can give a shot.

Thanks

Raghavendra

Hi

Thank you for additional information. Could you please try to save your document to any other format and let me know how it goes on you side.
Also, does the problem occur with all documents or only with some particular document?

Best regards,

Hi,

Please find below the snippet which we have developed for saving the document as Docx

Document mergedDoc = new Document();
mergedDoc.getSections().removeAt(0);
byteArrayStream = new ByteArrayInputStream(data);
Document doc = new Document(byteArrayStream);
// Merge the contents.
mergedDoc.appendDocument(doc,ImportFormatMode.KEEP_SOURCE_FORMATTING);
ByteArrayOutputStream destinationStream = new ByteArrayOutputStream();
mergedDoc.acceptAllRevisions();
mergedDoc.save(destinationStream, SaveFormat.DOCX);

The following is the exception which we get

Exception Message: Invalid save format requested.

11:38:56.097(09/19) INFO SmapiDebug : Could not find the Error Definition for errorId: MERGE_ERROR, smLog: DrsCOR, using default severity of INFORMATIONAL

11:38:56.097(09/19) ERROR DrsCOR : errorId = MERGE_ERROR, severity = INF, description = : MERGE_ERROR:Invalid save format requested.:Exception :java.lang.IllegalArgumentException:Invalid save format requested.[Thrd:pool-2-thread-1];stack=java.lang.IllegalArgumentException: Invalid save format requested.

at com.aspose.words.SaveOptions.createSaveOptions(SaveOptions.java:152)

at com.aspose.words.Document.h(Document.java:764)

at com.aspose.words.Document.save(Document.java:755)

Hi,

When i checked the following file ,

Package - com.aspose.words;

Class - SaveOptions

The switch case doesnt have the format related to Docx in your latest version of the jar. Can you please add this as well, since we are dependent on the Docx format totally.

Hi

Thank you for additional information. If your document contains macros then Aspose.Words can throw this exception. In this case you should use DOTM format instead of DOCX.

Best regards,

Hi,

Thanks for the response.

The DOTM file is not a windows recognizable format, we have requirements to merge DOCX format only, Can you please suggest us how to handle documents with Macros in DOCX format. We would appreciate your help in this regard since we are planning to hit the production release sooner.

Hi

Thanks for your request. The .dotm files are used in Microsoft Word 2007/2010 for document template files. The .dotm templates are used, when users wants to create several .docx documents with same formatting and with additional macros.

You can also remove all macros from a document using Document.RemoveMacros method.

Best regards,

Hi,

Thanks a lot for your inputs. The problem has been resolved and we are now able to save the documents

Hi

It is perfect, that you already resolved the problem. Please let me know in case of any issues. I will be glad to help you.

Best regards,

Sure, I appreciate your help and support in this regard