notify method
notify(args)
This is called to notify of document loading progress.
def notify(self, args: aspose.words.loading.DocumentLoadingArgs):
...
| Parameter | Type | Description |
|---|---|---|
| args | DocumentLoadingArgs | An argument of the event. |
Remarks
The primary uses for this interface is to allow application code to obtain progress status and abort loading 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 notify the user if document loading exceeded expected loading time (LoadingProgressCallback).
class LoadingProgressCallback(aw.loading.IDocumentLoadingCallback):
def __init__(self):
self.max_duration = 0.5
self.m_loading_started_at = datetime.datetime.now()
def notify(self, args):
from datetime import datetime
canceled_at = datetime.now()
elapsed_seconds = (canceled_at - self.loading_started_at).total_seconds()
if elapsed_seconds > self.max_duration:
raise Exception()
See Also
- module aspose.words.loading
- class IDocumentLoadingCallback
- property LoadOptions.progress_callback