JaBratsch / excellibrary

Automatically exported from code.google.com/p/excellibrary
0 stars 0 forks source link

Can't open big file #25

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Try to open big Excel file (about 300 Mb)

It seems problem is in "int" type insted of "uint" in position and 
counters.

Original issue reported on code.google.com by agurov.p...@gmail.com on 26 Apr 2009 at 7:07

GoogleCodeExporter commented 8 years ago
I have the same problem, I am unable to open large files. (although in my case 
"large" is actually around 10mb). The spreadsheets I am working with are quite 
complex though.

Original comment by KSchr...@gmail.com on 29 Apr 2009 at 8:47

GoogleCodeExporter commented 8 years ago
Here's a stacktrace when opening a large file (around 17mb)

The sectorID value was -3..

"Specified argument was out of the range of valid values.\r\nParameter name: 
sectorID"}  System.Exception {System.ArgumentOutOfRangeException}

>   
ExcelLibrary.dll!ExcelLibrary.CompoundDocumentFormat.SectorAllocation.GetNextSec
torID
(int sectorID = -3) Line 45 C#

ExcelLibrary.dll!ExcelLibrary.CompoundDocumentFormat.SectorAllocation.GetSIDChai
n(int 
StartSID = 37508) Line 59 + 0xe bytes   C#

ExcelLibrary.dll!ExcelLibrary.CompoundDocumentFormat.CompoundDocument.GetStreamD
ataAs
Bytes(int StartSID = 37508) Line 153 + 0x25 bytes   C#

ExcelLibrary.dll!ExcelLibrary.CompoundDocumentFormat.CompoundDocument.ReadDirect
oryEn
tries() Line 82 + 0x29 bytes    C#

ExcelLibrary.dll!ExcelLibrary.CompoundDocumentFormat.CompoundDocument.Open(Syste
m.IO.
Stream stream = {System.IO.FileStream}) Line 81 + 0x12 bytes    C#

ExcelLibrary.dll!ExcelLibrary.CompoundDocumentFormat.CompoundDocument.Open(strin
g 
file = "C:\\Users\\Public\\Documents\\PublicContactsTotal\\PublicContactsTotal 
- 
Copy.xls") Line 61 + 0xa bytes  C#

ExcelLibrary.WinForm.exe!ExcelLibrary.WinForm.Form1.openOToolStripMenuItem_Click
(obje
ct sender = {Open(&O)}, System.EventArgs e = {System.EventArgs}) Line 61 + 0x11 
bytes   
C#

Original comment by marco.di...@gmail.com on 13 May 2009 at 7:00

GoogleCodeExporter commented 8 years ago
Yes, SectorID is -3 because it has type "int", but it should be uint or long.

Original comment by agurov.p...@gmail.com on 13 May 2009 at 7:07

GoogleCodeExporter commented 8 years ago
Did you make this change in your local version? on which places. Can you send a 
patch?

Original comment by marco.di...@gmail.com on 13 May 2009 at 7:11

GoogleCodeExporter commented 8 years ago
No yet. I have plan to do it if authors can't do it but some time later.

Original comment by agurov.p...@gmail.com on 13 May 2009 at 7:14

GoogleCodeExporter commented 8 years ago
It seems the authors are not responding. You're mentioning that we should use 
uint or 
long instead of int.. Changing the type of the parameter results in many other 
int-
>uint/long changes. Is that the way to go? Just change all the parameters that 
are 
depended into uint or long.. And should we choose uint or long?

Original comment by marco.di...@gmail.com on 16 May 2009 at 9:08

GoogleCodeExporter commented 8 years ago
Any news on this issue?

Original comment by marco.di...@gmail.com on 2 Jun 2009 at 12:06

GoogleCodeExporter commented 8 years ago
From what I can tell, more than 109 SecIDs triggers problems when reading the 
MSAT 
in large files (> 7MB?).  Negative SecIDs have special meaning.

The following patch fixes my issues.

Original comment by vrom...@gmail.com on 3 Jun 2009 at 8:54

Attachments:

GoogleCodeExporter commented 8 years ago
After applying the patch from comment 8 by vromero i still get the negative 
sectorid 
when loading large files (>12mb)

Original comment by marco.di...@gmail.com on 4 Jun 2009 at 2:57

GoogleCodeExporter commented 8 years ago
For future reference anyone reading this:

I had the same issue using the compiled DLL writing to a file with approx 
290000 rows by 43 columns. I changed all the int's to int32's and rebuilt the 
project, this appeared to fix the problem. However now I just need to get 
around the OutOfMemory exceptions thrown after it hits 1.3GB on my 2gb machine. 
I'm guessing the code needs to save to disc once the buffer hits a certain 
size, although I've not looked into it.

Original comment by Jay.Ze...@gmail.com on 6 Mar 2011 at 2:23

GoogleCodeExporter commented 8 years ago
Hi !
"Jay.Ze..." : can you send me your source code ? I would like to test it for my 
software XL2Csv. This would be a good idea to Upload your fix into the main 
project for ExcelLibrary : there is no new download since 2009 !
Thanks, Patrice.
patrice.dargenton@free.fr

Original comment by patrice....@free.fr on 28 Mar 2011 at 9:40

GoogleCodeExporter commented 8 years ago
Hello, it is a very nice software I have been around looking for some 
alternative to read Excel file without Interop nor OleDB and I could not find 
it.

It is a shame that it does not work very good with large files.

Jay.Ze, I tried to do what you said but I am not able to get the complete 
program working, Can you please tell me more details of how you solved the 
problem?

It would be also nice to have the project as Patrice said.

Thanks,

Original comment by ennr...@gmail.com on 3 Aug 2011 at 1:10

GoogleCodeExporter commented 8 years ago
Hello.
Did anybody solved this problem?
I neew excellib for fast reading of big xls file only. Can anybody send me old 
version with his own fixes of this problem?

Original comment by panzerel...@gmail.com on 27 Mar 2012 at 3:31

GoogleCodeExporter commented 8 years ago
Hello , did anyone solved this problem ? ,pls help me solve this problem !

Original comment by wyhiswy...@gmail.com on 18 Feb 2013 at 11:06

GoogleCodeExporter commented 8 years ago
System.ArgumentOutOfRangeException was unhandled
  Message=Specified argument was out of the range of valid values.
Parameter name: sectorID
  Source=ExcelLibrary
  ParamName=sectorID
  StackTrace:
       at ExcelLibrary.CompoundDocumentFormat.SectorAllocation.GetNextSectorID(Int32 sectorID)
       at ExcelLibrary.CompoundDocumentFormat.SectorAllocation.GetSIDChain(Int32 StartSID)
       at ExcelLibrary.CompoundDocumentFormat.CompoundDocument.GetStreamDataAsBytes(Int32 StartSID)
       at ExcelLibrary.CompoundDocumentFormat.CompoundDocument.ReadDirectoryEntries()
       at ExcelLibrary.CompoundDocumentFormat.CompoundDocument.Open(Stream stream)
       at ExcelLibrary.CompoundDocumentFormat.CompoundDocument.Load(Stream stream)
       at ExcelLibrary.SpreadSheet.Workbook.Load(Stream stream)
       at ExcelLibrary.SpreadSheet.Workbook.Load(String file)

Original comment by magnat...@gmail.com on 18 Feb 2013 at 11:12

GoogleCodeExporter commented 8 years ago
to magnat...@gmail.com
yes , i had the same problem , did u solved ? 

Original comment by wyhiswy...@gmail.com on 19 Feb 2013 at 1:13

GoogleCodeExporter commented 8 years ago
Hi
I had this issue with an Excel 2003 file over 16mb.
In the code there is a bug which, after wading through the MS Compound Binary 
File documention,  I found and fixed below. 
Its in the Read of the DIFAT sectors (which the authors of this refer to as the
MasterSectorAllocTable); the read only comes into play with files over 6.8 MB)
Basically they load a bogus FAT idx into the list of FAT (SATs)Indexes.
(Its actually a link to the next DIFAT sector rather than a FAT sector)
My inelegant code which adjusts the SelectSIDs method is below
*****
        private void InitializeMasterSectorAllocationTable()
        {
            this.MasterSectorAllocationTable = new List<int>(NumberOfSecIDs);
            SelectSIDs(Document.Header.MasterSectorAllocationTable,0);
            int msid = Document.Header.FirstSectorIDofMasterSectorAllocationTable;
            while (msid != SID.EOC) 
            {
                CurrentMSATSector = msid;
                int[] SIDs = Document.ReadSectorDataAsIntegers(msid);
                SelectSIDs(SIDs,1);
                msid = SIDs[SIDs.Length - 1];
            }
        }

        private void SelectSIDs(int[] SIDs,int reduce_)
        {
            for (int i = 0; i < (SIDs.Length - reduce_); i++)
            {
                int sid = SIDs[i];
                if (MasterSectorAllocationTable.Count < NumberOfSecIDs)
                {
                    MasterSectorAllocationTable.Add(sid);
                }
                else
                {
                    break;
                }
            }
        }
Hope it works for folks - no guarantee its the same Sector issue as those above.

Original comment by arhausle...@gmail.com on 27 Oct 2014 at 9:16

GoogleCodeExporter commented 8 years ago
Thanks for the tip andrew.h...@gtempaccount.com

It works fine :)

Original comment by nestor.a...@gmail.com on 26 Jan 2015 at 5:46

GoogleCodeExporter commented 8 years ago
For those who don't have the means for re-building the dll themselves, I've 
created a new one using arhausle...@gmail.com's code. It seems to work just 
fine!

Original comment by eifelone...@gmail.com on 15 Apr 2015 at 2:20

Attachments: