System.NullReferenceException on mono-2.10(centos5.5)

Hi,

I'm evaluating Aspose.Cells on Linux with MONO.

I'm doing some test, but I can not open a workbook in xls or xlsx format.
My test workbook is very simple.

System.NullReferenceException: Object reference not set to an instance of an object
at ?.?.? (System.String , Int32 , FontStyle ) [0x00000] in :0
at ?.?.? (Aspose.Cells.WorksheetCollection ) [0x00000] in :0
at Aspose.Cells.WorksheetCollection.? () [0x00000] in :0
at Aspose.Cells.WorksheetCollection..ctor (Aspose.Cells.Workbook ) [0x00000] in :0
at Aspose.Cells.Workbook.? (System.String , Aspose.Cells.LoadOptions ) [0x00000] in :0
at Aspose.Cells.Workbook..ctor (System.String file) [0x00000] in :0
at xlsconv.Program.Run (System.String[] args) [0x00000] in :0

Here is the code I use for testing:

...

Aspose.Cells.Workbook wbk = new Aspose.Cells.Workbook("in.xls"); // exception raised

wbk.Save("out.xlsx", SaveFormat.Xlsx);

...

Aspose.Cells.Workbook wbk = new Aspose.Cells.Workbook("in.xlsx"); // exception raised

wbk.Save("out.xls", SaveFormat.SpreadsheetML);

...

The Aspose.Cells.dll(net2.0) version is 7.4.3.0 .

I'd like to know if I'm doing anything wrong or if Aspose.Cells is actually not supported on MONO. If not, is there any plan to do it?

Thanks in advance,

Ryouma


Hi,


I have installed mono 2.10.9 build on my Windows. I tested it with some CS console applications in which I opened an XLS and XLSX files and re-saved them back by Aspose.Cells APIs, it works fine here. I used mono command lines on mono command prompt to compile and run the program.
I am using our latest fix/version : Aspose.Cells for .NET v7.4.3.4 please try it.

Simple code:

Workbook book = new Workbook(“e:\test2\test.xls”);

book.Save(“e:\test2\mono test\testout.xls”);

System.Console.WriteLine(“Done!”);

Do you get the error with every file or with some specific files, kindly attach the sample files here.

Also, could you check if you can instantiate new Workbook and create the files fine or not.

Thank you.


Hi Amjad,


Thanks for your reply.

Aspose.Cells runs well on my windows os with mono-2.10.9.

But it always raise exception on my centos-5.5(or 5.8) with mono-2.10.8.

Here is my command log for install mono-2.10.8.

# install dependencies
yum -y install fontconfig-devel freetype-devel giflib-devel glib2-devel libexif-devel libjpeg-devel libpng-devel libtiff-devel libXrender-devel

# compile & install
wget http://download.mono-project.com/sources/mono/mono-2.10.8.tar.gz
tar zxvf mono-2.10.8.tar.gz
cd mono-2.10.8
./configure --prefix=/opt/mono
make & make install

# test
/opt/mono/bin/mono xlsconv.exe

System.NullReferenceException: Object reference not set to an instance of an object
at ?.?.? (System.String , Int32 , FontStyle ) [0x00000] in :0
at ?.?.? (Aspose.Cells.WorksheetCollection ) [0x00000] in :0
at Aspose.Cells.WorksheetCollection.? () [0x00000] in :0
at Aspose.Cells.WorksheetCollection…ctor (Aspose.Cells.Workbook ) [0x00000] in :0
at Aspose.Cells.Workbook.? (System.String , Aspose.Cells.LoadOptions ) [0x00000] in :0
at Aspose.Cells.Workbook…ctor (System.String file) [0x00000] in :0
at DocConvert.Program.Run (System.String[] args) [0x00000] in :0

Thank you in advance.

Best regards,
Ryouma


Hi,


Thanks for your feedback.

We need to investigate why Aspose.Cells is not working on mono-2.10.8(centos5.5) although it works absolutely fine on mono (Windows). I have logged a ticket with an id “CELLSNET-41722” for your issue. We will look into it soon.

Once we have any update on it, we will let you know here.

Thank you.

Hi,


After evaluating your issue further, we think it is not a bug in Aspose.Cells rather you need to specify font directory before using Aspose.Cells APIs, e.g. you may add a line to set the font directory path on your centos OS in your project:

CellsHelper.FontDir = “…specify fonts directory path on linux…”;
//… Your code goes here.

Let us know if you still have any issue.

Thank you.

Thanks for your reply.


Could you tell me how to install the windows TrueType font to the linux centos machine?

Thanks in advance.

Hi,


Please see the document for your reference:
http://www.itzgeek.com/how-tos/linux/centos-how-tos/how-to-install-microsoft-truetype-fonts-in-centos-6-rhel-6.html#axzz2UZzFhGmq

Thank you.

Thanks a lot for your help.


I successfully install the ms true type fonts on centos.
The Aspose.Cells runs well.

Best regards,
Ryouma


Hi,

Thanks for your posting and using Aspose.Cells.

We are pleased to know that your issue is resolved. If you face any other issue, please feel free to post on our forums, we will be glad to help you further.