c# - Aspose.Cells.CellsException - "You are using an evaluation copy and have opened files exceeding limitation"

标签 c# asp.net excel aspose aspose-cells

我创建了一个返回 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/

相关文章:

excel - 按索引号引用工作簿

c# - 用随机数字更新多行

c# - 属性的 XML 反序列化

c# - 通过 TypeBuilder 添加 DisplayAttribute

c# - 不同计算机上的 WPF 应用程序不显示窗口

c# - 用户 '' @localhost 的访问被拒绝(使用密码 : no)

ASP.NET MVC 5 属性路由 : Url. 操作返回 null

javascript - AJAX 调用后无法显示值 (ASP.NET MVC)

Excel公式从单个单元格中获取所有电子邮件地址

excel - 在 2 个日期之间获取小时数