I have created a function that returns a datatable
from a workbook
.
public async Task<DataTable> GetDataTableFromTabRowColumn(string sheetName, int startRow, int endRow, int startCol, int endCol)
{
var task = new Task(() =>
{
DataTable dt = new DataTable();
Workbook wb = new Workbook(FilePath); // error line
Worksheet worksheet = wb.Worksheets[sheetName];
dt = worksheet.Cells.ExportDataTable(startRow - 1, startCol - 1, (endRow - startRow + 1), (endCol - startCol + 1), options);
});
task.Start();
await task;
return dt;
}
It was running fine. When I made the function async, it's showing error:
Aspose.Cells.CellsException: 'You are using an evaluation copy and have opened files exceeding limitation.'
I am using licensed Aspose. Please help
You must add the licence Aspose by these methods
Aspose.Cells tries to find the license in the following locations:
Explicit path The folder that contains Aspose.Cells.dll
The folder that contains the assembly that called Aspose.Cells.dll
The folderthat contains the entry assembly (your .exe)
An embedded resource inthe assembly that called Aspose.Cells.dll
//Instantiate an instance of license and set the license file through its path
Aspose.Cells.License license = new Aspose.Cells.License();
license.SetLicense("Aspose.Cells.lic");
or
//Instantiate an instance of license and set the license through a stream
Aspose.Cells.License license = new Aspose.Cells.License();
license.SetLicense(myStream);