We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Finalize aspose task

Hello. How i can get task id of Aspose.Cells.Worksheet, i search by name in Process.GetProcesses() but doesn’t exist. Thx

@scascalesp,
Could you please share more details about your requirement? Is it possible to get this task id for MS Excel sheet? If yes, please share the steps with us for our reference.

Hi. I need to know kill the task
" Is it possible to get this task id for MS Excel sheet?"… Of course.with objExcel.Hwnd and then:

<Runtime.InteropServices.DllImport(“user32.dll”)> _
Private Shared Function GetWindowThreadProcessId(ByVal hWnd As IntPtr, ByRef lpdwProcessId As UInteger) As UInteger
End Function

Public Shared Function KillTask(ByVal hWnd As Integer) As Boolean
Dim processID As UInteger
'GetWindowThreadProcessId(DirectCast(hWnd, IntPtr), processID)
GetWindowThreadProcessId(hWnd, processID)
If processID = 0 Then Return False
Try
Process.GetProcessById(CInt(processID)).Kill()
Catch generatedExceptionName As ArgumentException : Return False
Catch generatedExceptionName As System.ComponentModel.Win32Exception : Return False
Catch generatedExceptionName As NotSupportedException : Return False
Catch generatedExceptionName As InvalidOperationException : Return False
End Try
Return True
End Function

@scascalesp,
Thank you for providing more information. MS Excel is an application which is installed on the system and creates multiple processes. Those processes can be accessed and killed when required whereas Aspose.Cells is an API which does not create its own process. It is part of the developed application and no independent process is created. Like when it is used in VS.NET project, the process in the task manager would be something like vs.exe. You can kill only this thread if required.

We would suggest you to utilize the Aspose.Cells API features for interrupting or cancelling the formula calculation of workbook. Similarly you can stop conversion or loading of large files by using Interrupt monitor when it is taking too long time. You may go through the following articles for more information.

Interrupt or Cancel the Formula Calculation of Workbook
Stop conversion or loading using InterruptMonitor when it is taking too long

But… if I can’t finish the task. What is the best way to make sure that the aspose object is closed?
I try asposeworkbook.dispose; asposeworkbook = null; in finally statement but i see this message equally

“Aspose.Cells.CellsException: You are using an evaluation copy and have opened files exceeding limitation.”

@scascalesp,

As you are working in evaluation mode (using Aspose.Cells APIs without setting a valid license in code), we recommend you to kindly ask for 30 days temporary license so you may get a temporary license to work with the APIs with full capacity or to avoid any such (your mentioned exception) error in your application, see the document on how to obtain temporary license for your requirements:
https://purchase.aspose.com/temporary-license
Also, see the document for your reference:
https://docs.aspose.com/display/cellsnet/Licensing

Should you have any further queries or issue, feel free to contact us any time, we will be happy to assist you soon.