notify method
notify(args)
This is called to notify of document saving progress.
def notify(self, args: aspose.words.saving.DocumentSavingArgs):
...
| Parameter | Type | Description |
|---|---|---|
| args | DocumentSavingArgs | An argument of the event. |
Remarks
The primary uses for this interface is to allow application code to obtain progress status and abort saving process.
An exception should be threw from the progress callback for abortion and it should be caught in the consumer code.
Examples
Shows how to manage a document while saving to html (SavingProgressCallback).
class SavingProgressCallback(aw.saving.IDocumentSavingCallback):
def __init__(self):
self.max_duration = 0.1
self.m_saving_started_at = datetime.datetime.now()
def notify(self, args):
canceled_at = datetime.datetime.now()
elapsed_seconds = (canceled_at - m_saving_started_at).total_seconds()
if elapsed_seconds > self.max_duration:
raise Exception()
Shows how to manage a document while saving to docx (SavingProgressCallback).
class SavingProgressCallback(aw.saving.IDocumentSavingCallback):
def __init__(self):
self.max_duration = 0.01
self.m_saving_started_at = datetime.datetime.now()
def notify(self, args):
canceled_at = datetime.datetime.now()
elapsed_seconds = (canceled_at - m_saving_started_at).total_seconds()
if elapsed_seconds > self.max_duration:
raise Exception()
See Also
- module aspose.words.saving
- class IDocumentSavingCallback