Missing named ranges when workbook is saved to memory stream

Hi,



I have a spreadsheet (attached) here that has a named range “ColumnRanges.Action”. When I open this with Aspose, save it to memory stream and then re-open it with Aspose, the named range is lost. I’ve also noticed that some other named ranges are missing too.



Here’s the code we used:



public void SaveOpen_NamedRange_CanRetrieveNamedRange()

{

var name = “ColumnRanges.Action”;



var workbook = new Workbook();

workbook.Open(“c:\SaveStreamOpenStream.xls”, FileFormatType.Default);



var worksheet = workbook.Worksheets[0];



var range = worksheet.Workbook.Worksheets.GetRangeByName(name) ??

worksheet.Workbook.Worksheets.GetRangeByName(string.Format("{0}!{1}", worksheet.Name, name));



Assert.IsNotNull(range);



var stream = new MemoryStream();

workbook.Save(stream, FileFormatType.SpreadsheetML);



var memoryStream = new MemoryStream(stream.ToArray());

workbook = new Workbook();

workbook.Open(memoryStream, FileFormatType.SpreadsheetML);



worksheet = workbook.Worksheets[0];



range = worksheet.Workbook.Worksheets.GetRangeByName(name) ??

worksheet.Workbook.Worksheets.GetRangeByName(string.Format("{0}!{1}", worksheet.Name, name));



Assert.IsNotNull(range);



}



-Steve

Hi Steve,

Thanks for providing us the template file.

After an initial test implementing your scenario, I can reproduce the issue as you have described. I think the issue is there when you save the file to streams with SpreadsheetML file format type as the issue does not occur when you save the file to streams with other file format types (e.g..,Excel2003, Excel2000 etc. ).

Anyways we will figure out the issue soon.

Thank you.

Hi Steve,

Please try the attached fix (4.5.1.24), we have supported to read the named ranges from SpreadsheetML files.

Thank you.

The fix is good. Thanks!