我创建了一个返回 datatable
的函数来自 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;
}
它运行良好。当我使函数异步时,它显示错误:
Aspose.Cells.CellsException: 'You are using an evaluation copy and have opened files exceeding limitation.'
我正在使用许可的 Aspose。请帮忙
最佳答案
您必须通过 these methods 添加许可证 Aspose
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");
或者
//Instantiate an instance of license and set the license through a stream
Aspose.Cells.License license = new Aspose.Cells.License();
license.SetLicense(myStream);
关于c# - Aspose.Cells.CellsException - "You are using an evaluation copy and have opened files exceeding limitation",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54004259/