Unable to use Aspose.Cells API in SP2010 EventReceiver project

Hi,

Could you please try some other xls/xlsx file? It could be possible that Aspose.Cells crashes because of some bug.

Could you please attach your xls/xlsx file which is failing?

However, you can run the same code but with the following modification so that I know that exception is not occurring because of source xls/xlsx file?

Change your following code


//Here you are creating workbook from source file

Aspose.Cells.Workbook wb = new Aspose.Cells.Workbook(fileStream);


into
//Now create workbook from scratch and see the code runs or not
Aspose.Cells.Workbook wb = new Aspose.Cells.Workbook();

Hi,

We have looked into your issue and screenshot.

We found that the exception is caused because we could not find font setting files.

Please add them to your project by setting CellsHelper.FontDir() method.

Hi.

What should I set CellsHelper.FontDir to other than default? This really looks like a bug in your software b/c I should not be required to know and/or hard code the location of the system fonts on the web server in order to be able to convert from Excel to PDF.

In any case, I tried setting CellsHelper.FontDir as follows:

CellsHelper.FontDir = @“C:\Windows\Fonts”;
(that’s where all my font files are)

But I am still getting the following error on calling the Save method:
[Aspose.Cells.CellsException] = {“Object reference not set to an instance of an object.”}

(I also created and tried converting a new XLS file but still get the same error)

Any suggestions on how to finally resolve this problem?

Also, do you know whether your PDF conversion works with sandboxed solutions?



Thanks!

Hi,

I have forwarded your question to development team and logged your comments against the issue id: SHAREPOINT-40008

We will look into your issue soon and give you advice.

Did you try my other suggestion in which I said, create a workbook object from scratch and see if it works fine or still throws exception? It will help me sort out your issue.

Hi,

In the a medium trust environment, the application only can access the file in the current application directory.

If you set CellsHelper.FontDir = @“C:\Windows\Fonts”, an inner FileIOPermission exception will be caught in Aspose.Cells.

If you want to open and save the file, please check whether the file could be accessed by File.Open and File.Create without calling Aspose.Cells.

We created a sample web project in the attached zip for medium trust environment. Please check it . We hope it could help you.