Hi Colleagues,
I open several XLS with EPPPlus, all fine. But some lead to an endless loop while the file opens just fine in Excel.
I tried to nail down the issue, here is what I found:
//Excerpt from ExcelWorksheet.cs (latest v4.0.4)
CreateXML...
XmlTextReader xr = new XmlTextReader(stream);
xr.ProhibitDtd = true;
xr.WhitespaceHandling = WhitespaceHandling.None;
LoadColumns(xr); //columnXml
long start = stream.Position; __// Save start position of stream__
LoadCells(xr);
var nextElementLength = GetAttributeLength(xr);
long end = stream.Position - nextElementLength; __//Get End position of Stream
__
...
in my error case, start==end==4096.
According to .net info about XMLTextReader, it is buffered, thus using stream.Position does not have to work - which seems to be the case here.
As there doesn't seem to exist an easy (working) substitute for stream.Position, I can't fix on my own. Any ideas how this could be done?
(As the affected XLS is confidential, I can't upload it)
br, Christian
I open several XLS with EPPPlus, all fine. But some lead to an endless loop while the file opens just fine in Excel.
I tried to nail down the issue, here is what I found:
//Excerpt from ExcelWorksheet.cs (latest v4.0.4)
CreateXML...
XmlTextReader xr = new XmlTextReader(stream);
xr.ProhibitDtd = true;
xr.WhitespaceHandling = WhitespaceHandling.None;
LoadColumns(xr); //columnXml
long start = stream.Position; __// Save start position of stream__
LoadCells(xr);
var nextElementLength = GetAttributeLength(xr);
long end = stream.Position - nextElementLength; __//Get End position of Stream
__
...
in my error case, start==end==4096.
According to .net info about XMLTextReader, it is buffered, thus using stream.Position does not have to work - which seems to be the case here.
As there doesn't seem to exist an easy (working) substitute for stream.Position, I can't fix on my own. Any ideas how this could be done?
(As the affected XLS is confidential, I can't upload it)
br, Christian