-
Notifications
You must be signed in to change notification settings - Fork 990
No data returned in large xls Excel 97-2003 worksheet #561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi, Interesting, thank you. The Excep contains a "V4 Macro Sheet", but ExcelDataReader doesn't recognize that and skips it. I can read it after changing certain sheet type checks (and optimizing the cyclic sector check): --- a/src/ExcelDataReader/Core/BinaryFormat/XlsWorkbook.cs
+++ b/src/ExcelDataReader/Core/BinaryFormat/XlsWorkbook.cs
@@ -173,7 +173,7 @@ namespace ExcelDataReader.Core.BinaryFormat
InterfaceHdr = hdr;
break;
case XlsBiffBoundSheet sheet:
- if (sheet.Type != XlsBiffBoundSheet.SheetType.Worksheet)
+ if (sheet.Type != XlsBiffBoundSheet.SheetType.Worksheet && sheet.Type != XlsBiffBoundSheet.SheetType.MacroSheet)
break;
Sheets.Add(sheet);
break;
--- a/src/ExcelDataReader/Core/BinaryFormat/XlsWorksheet.cs
+++ b/src/ExcelDataReader/Core/BinaryFormat/XlsWorksheet.cs
@@ -435,7 +435,7 @@ namespace ExcelDataReader.Core.BinaryFormat
using (var biffStream = new XlsBiffStream(Stream, (int)DataOffset, Workbook.BiffVersion, null, Workbook.SecretKey, Workbook.Encryption))
{
// Check the expected BOF record was found in the BIFF stream
- if (biffStream.BiffVersion == 0 || biffStream.BiffType != BIFFTYPE.Worksheet)
+ if (biffStream.BiffVersion == 0 || (biffStream.BiffType != BIFFTYPE.Worksheet && biffStream.BiffType != BIFFTYPE.v4MacroSheet))
return;
XlsBiffHeaderFooterString header = null;
--- a/src/ExcelDataReader/Core/CompoundFormat/CompoundDocument.cs
+++ b/src/ExcelDataReader/Core/CompoundFormat/CompoundDocument.cs
@@ -75,12 +75,19 @@ namespace ExcelDataReader.Core.CompoundFormat
internal List<uint> GetSectorChain(uint sector, List<uint> sectorTable)
{
List<uint> chain = new List<uint>();
+#if !NET20
+ HashSet<uint> uniq = new HashSet<uint>();
+#endif
while (sector != (uint)FATMARKERS.FAT_EndOfChain)
{
chain.Add(sector);
sector = GetNextSector(sector, sectorTable);
+#if !NET20
+ if (!uniq.Add(sector))
+#else
if (chain.Contains(sector))
+#endif
{
throw new CompoundDocumentException(Errors.ErrorCyclicSectorChain);
} |
thanks! I will build locally and apply fix. Will this get rolled into a distributed release or would you recommend forking and merge with changes with main branches? |
Hi, I'm sure this will be fixed at some point, but I cannot give an ETA. I'd like to familiarize myself with these "Macro Sheets" a bit more - f.ex can we assume to treat them as regular sheets? Maybe they should always be last? Until then, to progress I recommend to patch the latest develop branch and use that. The latest prerelease nuget was built from the latest develop branch. |
thank you very much - this library is great, in my tests so much faster than the alternatives for read-only operations and easy to use! |
I have a very large Excep that is read
calling
ExcelReaderFactory.CreateReader(stream)
works but when I then callreader.Read()
no data is returnedCannot attach file, but it is available on (318 MB)
https://vondavon.com/exceldatareader/vehicles_xls.xls
The text was updated successfully, but these errors were encountered: