Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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

Ask Question

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

I have a hard time believing that this is your exact (real) code because this code tries to return dt from a scope where it does not exist. – Peter B Jan 2, 2019 at 10:08 It does sound a little like a fault in their license checking. But it's hard to be sure, like @peterB notes this is bad pseudo code. Contact the aspose helpdesk first and when you wan to ask here, post 2 minimal but correct samples of working an not-working. – bommelding Jan 2, 2019 at 10:16 Ya.. That will be a issue. As I mentioned. I have just added the code within the task. The original one had only 4 lines (currently within the task) and returned dt. Since it's breaking before returning anything. I didn't figure out that issue – Adrita Sharma Jan 2, 2019 at 10:17

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);

Before blaming it on Aspose, lets fix the async approach.

public async Task<DataTable> GetDataTableFromTabRowColumn(string sheetName, int startRow, int endRow, int startCol, int endCol)
    var task = Task.Run(() =>
        Workbook wb = new Workbook(FilePath); // error line
        Worksheet worksheet = wb.Worksheets[sheetName];
        DataTable dt = worksheet.Cells.ExportDataTable(startRow - 1, startCol - 1, (endRow - startRow + 1), (endCol - startCol + 1), options);
        return dt;
    return await task;            

Note that dt can and should be local like this.
Remove the private DataTable dt = null; line because it could cover up an error.

When this still gives an error I would look at Aspsose again.

Thanks a lot.. I have implemented it. In aspose license file, there is a line <LicenseNote>Limited to 10 developers</LicenseNote> May be the issue came because of that.. – Adrita Sharma Jan 2, 2019 at 11:35 That would not explain the difference with non-async. Unless the async version is used to process more data in parallel. – bommelding Jan 2, 2019 at 11:43 I guess may be your licensing code is not processed at all, see the document on how to apply license for your reference: docs.aspose.com/display/cellsnet/licensing Please make sure your licensing code is processed first and at least once in the whole application life cycle. PS. I am working as Support developer/ Evangelist at Aspose. – Amjad Sahi Jan 3, 2019 at 8:27

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.