Excel data reader - dimension null

Oct 1, 2009 at 4:15 PM

Hi All,

 

I like this tool, I was start using it... now encounter a problem with dimension null and ignores all the other tabs. I am trying to parse the workbook it has 29 tab(sheets). it captures upto 9 sheets and rest of the tabs fails. I debugged and it is failing because of dimension is null. btw - all the tabs are same structure ( i mean data is same, the difference is each tab is by month)

Any help greatly appreciated... i am middle of this project... thanks a lot.

Oct 2, 2009 at 4:49 PM

After further debug... i found that there is issue with sheetId,in function ReadWorkbook

for some reason the SheetId with sheet name doesnt exist... workbook getting sheet id with that id there is not sheet.....

I dont know how to fix it... but, i will keep looking...

sheets.Add(new XlsxWorksheet(reader.GetAttribute(A_name), int.Parse(reader.GetAttribute(A_sheetId)), reader.GetAttribute(A_rid)));

Please post any tips or fixes........ thanks.


 

 

Oct 2, 2009 at 6:17 PM

Hi All,

I changed this function and it seems to be working........

private void ReadWorkbook(Stream xmlFileStream)
        {
            sheets = new List<XlsxWorksheet>();

            using (XmlReader reader = XmlReader.Create(xmlFileStream))
            {
                while (reader.Read())
                {
                    if (reader.NodeType == XmlNodeType.Element && reader.Name == N_sheet)
                    {
                        /**
                         * Dt: 2009-10-02
                         * RajS
                         * Commented original code
                         * Sheetid is not correct, changed to get it from rId
                         *
                         * */
                        /* sheets.Add(new XlsxWorksheet(
                                               reader.GetAttribute(A_name),
                                               int.Parse(reader.GetAttribute(A_sheetId)), reader.GetAttribute(A_rid)));
                        */

                        string sheet_name = reader.GetAttribute(A_name);
                        int sheet_id = int.Parse(reader.GetAttribute(A_sheetId));
                        string sheet_rid = reader.GetAttribute(A_rid);
                        int sheet_id2 = int.Parse(sheet_rid.Replace("rId",""));
                        
                        sheets.Add(new XlsxWorksheet(sheet_name,sheet_id2, sheet_rid));
                    }

                }

                xmlFileStream.Close();
            }

        }

 

Pls add your comments...

 

Thanks a lot

Nov 17, 2009 at 5:57 AM

Hi,

i did the same bugfix for my project. It works fine and should be added to the next release.

Cheers