How to Stop Document.save method after Specific Time using Java

Hello!

I am addressing you with an request to provide us with support to terminate the Word document saving operation, regardless of the type/format of the target document.

Just to remind you… a couple of months ago I asked if this support exists and how this could be done (workaround) if it does not exist (Cancelling of Saving Document process (Java)). In the same forum message I referred to two more threads on this topic (Cancelling save operation and Stop Document.Save method after specific time).
Then Tahir Manzoor replied that support was not yet provided and forwarded the code based on starting the saving process in a separate thread and terminating it after some time.
Unfortunately, the proposed procedure did not work properly - the saving process was not interrupted and resources were not released.

Therefore, on this occasion, I am not looking for a workaround, but to provide us with a method that will be part of Words API, and which will cancel the execution of the Document.save method.

Best regards!

@zpredojevic

We already logged feature request for your requirement in our issue tracking system. Currently, there is no update available on this feature. We will inform you via this forum thread once there is an update available on it.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-11575) have been fixed in this Aspose.Words for .NET 22.1 update also available on NuGet.

@tahir.manzoor

Hi there!

Once again, I’m writing on this topic.
In order not to make it too long, but also so that you don’t have to go back through the whole correspondence, I’m asking for support to stop/terminate the saving operation, but support in terms of the provided method by which we could do it (not a workaround).

Concretely, the above is necessary for us in situations where the save operation takes too long, so it would be best if this method could (optionally) also receive an argument that would determine the duration of the save operation before it is terminated (e.g. in milliseconds).

In your last answer, you wrote that you developed support for .NET. However, when I posted the request, I wrote that it was about Java, so please log this request and provide the mentioned functionality when you are able.

Thank you!

Best regards!
Nenad

@zpredojevic You can use IDocumentSavingCallback to control document saving process.

You can consider using IPageLayoutCallback for interrupting layout process, for example if you need to render only the first page of the document.