Timeout on Opening a document

Aspose Support,

Is there a chance you can add a timeout option for the document constructor? This is mainly for Aspose.Slides but also happens on Aspose.Cells and Aspose.Words

I try to open a presentation and it freeze on New Aspose.Slides.Presentation(…)

It would be very helpful if you could add an optional timeout argument where it returns with an exception if timeout lapse i.e. New Aspose.Slides.Presentation(filename, timeout)



We are looking into your requirement. In the mean while please note with respect to Aspose.Cells, timeout option feature is not present. However, Aspose.Cells provides InterruptMonitor which you can use to interrupt the loading of workbook if it is taking long time. You will need two threads for it. One thread will load the workbook and other thread will monitor and interrupt the loading of workbook. Sample code snippet is given below.


InterruptMonitor im = new InterruptMonitor();

//This function is in main thread
void LoadWorkbook()
LoadOptions opts = new LoadOptions();
opts.InterruptMonitor = im;

Workbook wb = new Workbook("Large.xlsx", opts);

//This function is in another thread.
void WaitForWhileAndThenInterrupt()
//Wait for a while and then interrupt
1 Like