This project has moved. For the latest updates, please go here.

There isn't a worksheet named '#REF'.

Mar 28, 2012 at 5:53 PM

Hello all,

I have been struggling to get some basic functionality using OpenXML sdk so am trying out ClosedXML.

I am trying to open a new workbook from a stream.

However I get this error : There isn't a worksheet named '#REF'.

Here's the code snippet:

Stream stream = librariesManager.Download(doc);
 
                byte[] bytesInStream = new byte[stream.Length];
                using(MemoryStream fStream = new MemoryStream())
                {   
                    stream.Read(bytesInStream, 0, bytesInStream.Length);
                    fStream.Write(bytesInStream, 0, bytesInStream.Length);
                    // Rewind ready for reading (typical scenario)
                    fStream.Position = 0;
 
                    var w = new XLWorkbook(stream);
                    var wb = new XLWorkbook(fStream);

 

if I try the "stream" object, I get an error that the stream doesn't support seek.

On using the MemoryStream object, I get the error mentioned above.

I was able to open and read the file by creating a SpreadSheetDocument object and parse it. So I guess, the file is valid.

 

Any ideas?

Thanks!

Coordinator
Mar 28, 2012 at 6:07 PM

What happens if you open the file directly? (var wb = new XLWorkbook("TheFile.xlsx")

Mar 28, 2012 at 7:59 PM
Edited Mar 28, 2012 at 7:59 PM

Just tried that... the same error comes up.

 string filePath = @"C:\Documents and Settings\v002668\My Documents\Amegy redesign\Consumer Loan Rate Sheet.xlsx";
 var w = new XLWorkbook(filePath);
Coordinator
Mar 28, 2012 at 8:10 PM

Create a new issue and attach a file that fails to load.