GridDesktop.ImportFromExcelFile gets problem while using a MemoryStream with merged cells

Hello.

I work with Microsoft Visual Basic .NET and use FlexCel (http://www.tmssoftware.com/site/flexcelnet.asp) component for generation Excel document and saving it into a MemoryStream. If Excel document contains merged cells with text, then while I use ImportFromExcelFile(MemoryStream) method to load the document into the GridDesktop, ith throws me the Exception "NullReferenceException: Object reference not set to an instance of an object". When I try to Import document with empty merged cells, it works.

Here is the example of the code:

Imports FlexCel.XlsAdapter

Imports System.IO

Dim xls As New XlsFile

Dim ms as New MemoryStream

xls.NewFile(1) 'Create new XLSFile object with 1 worksheet

xls.MergeCells(1,1,1,5) 'Merge cells from A1 (1st row, 1st column) to E1 (1st row, 5th column)

xls.SetCellFromString(1,1,"Test") 'Type "Test" into A1 cell

xls.Save(ms) 'Saving Excel document into a memory stream

GridDesktop1.ImportExcelFile(ms) 'Here is the place where exception raise

Hi,


Well, the issue might be with your Flexcell component. I have tested using my sample code (excluding Flexcell component), I have imported an Excel file (created in MS Excel manually) which has merged cells in it from the memory stream, I even exported the same file to the disk using Aspose.Cells.GridDesktop, it all works fine.

I have attached my input and output Excel files here. I am using latest version v2.6.4.xxxx.

Sample code:

this.gridDesktop1.Clear();

FileStream fs = File.Open(@“e:\test2\mergedcells.xls”, FileMode.Open);
byte[] buffer = new byte[fs.Length];
fs.Read(buffer, 0, buffer.Length);
MemoryStream ms = new MemoryStream(buffer);
this.gridDesktop1.ImportExcelFile(ms);

this.gridDesktop1.ExportExcelFile(“e:\test2\outmergedcells.xls”);


Thank you.

This file was created with FlexCel component. It’s properly opened by Microsoft Office Excel 2007, but when I try to load it into GridDecktop, it raise me “NullReferenceException: Object reference not set to an instance of an object”.

Hi,


Thanks for providing the sample Excel file.

I can find the issue/errer (“NullReferenceException:…”) when loading your attached XLSX file (https://forum.aspose.com/t/121795) from the memory stream.

Sample code:
FileStream fs = File.Open(@“e:\test2\test.xlsx”, FileMode.Open);
byte[] buffer = new byte[fs.Length];
fs.Read(buffer, 0, buffer.Length);
MemoryStream ms = new MemoryStream(buffer);

this.gridDesktop1.ImportExcelFile(ms); //Error

I have logged a ticket for it with an id: CELLSNET-40051. We will look into it soon.

Thank you.

Hi,


Please try our latest fixed version of Aspose.Cells.GridDesktop v2.6.4.2002, we have fixed the issue.

Thank you.

The issues you have found earlier (filed as CELLSNET-40051) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.