Hiii everybody, i'm a newbie in here, please give me a guidence, i'm using NPOI 2.0.1.0
and i got problem when read the excel :
public static ArrayList ReaderExcel(string path, string SheetName, int rowStart, int columnStart, int columnEnd)
{
ArrayList array = new ArrayList();
using (StreamReader input = new StreamReader(path))
{
POIFSFileSystem p = new POIFSFileSystem(input.BaseStream);
HSSFWorkbook wb = new HSSFWorkbook(p,true);
IWorkbook workbook = wb;
..............
}
it give me this error :
Unable to construct record instance
at NPOI.HSSF.Record.RecordInputStream.CheckRecordPosition(Int32 requiredByteCount)
at NPOI.HSSF.Record.RecordInputStream.ReadByte()
at NPOI.HSSF.Record.LabelRecord..ctor(RecordInputStream in1)
the error was at line : HSSFWorkbook wb = new HSSFWorkbook(p,true);
this is the complete stack trace :
at NPOI.HSSF.Record.RecordFactory.ReflectionConstructorRecordCreator.Create(RecordInputStream in1)
at NPOI.HSSF.Record.RecordFactory.CreateSingleRecord(RecordInputStream in1)
at NPOI.HSSF.Record.RecordFactoryInputStream.ReadNextRecord()
at NPOI.HSSF.Record.RecordFactoryInputStream.NextRecord()
at NPOI.HSSF.Record.RecordFactory.CreateRecords(Stream in1)
at NPOI.HSSF.UserModel.HSSFWorkbook..ctor(DirectoryNode directory, Boolean preserveNodes)
at NPOI.HSSF.UserModel.HSSFWorkbook..ctor(DirectoryNode directory, POIFSFileSystem fs, Boolean preserveNodes)
at NPOI.HSSF.UserModel.HSSFWorkbook..ctor(POIFSFileSystem fs, Boolean preserveNodes)
really appreciate if someone can give enlightment about my case...
Comments: ** Comment from web user: odheey **
and i got problem when read the excel :
public static ArrayList ReaderExcel(string path, string SheetName, int rowStart, int columnStart, int columnEnd)
{
ArrayList array = new ArrayList();
using (StreamReader input = new StreamReader(path))
{
POIFSFileSystem p = new POIFSFileSystem(input.BaseStream);
HSSFWorkbook wb = new HSSFWorkbook(p,true);
IWorkbook workbook = wb;
..............
}
it give me this error :
Unable to construct record instance
at NPOI.HSSF.Record.RecordInputStream.CheckRecordPosition(Int32 requiredByteCount)
at NPOI.HSSF.Record.RecordInputStream.ReadByte()
at NPOI.HSSF.Record.LabelRecord..ctor(RecordInputStream in1)
the error was at line : HSSFWorkbook wb = new HSSFWorkbook(p,true);
this is the complete stack trace :
at NPOI.HSSF.Record.RecordFactory.ReflectionConstructorRecordCreator.Create(RecordInputStream in1)
at NPOI.HSSF.Record.RecordFactory.CreateSingleRecord(RecordInputStream in1)
at NPOI.HSSF.Record.RecordFactoryInputStream.ReadNextRecord()
at NPOI.HSSF.Record.RecordFactoryInputStream.NextRecord()
at NPOI.HSSF.Record.RecordFactory.CreateRecords(Stream in1)
at NPOI.HSSF.UserModel.HSSFWorkbook..ctor(DirectoryNode directory, Boolean preserveNodes)
at NPOI.HSSF.UserModel.HSSFWorkbook..ctor(DirectoryNode directory, POIFSFileSystem fs, Boolean preserveNodes)
at NPOI.HSSF.UserModel.HSSFWorkbook..ctor(POIFSFileSystem fs, Boolean preserveNodes)
really appreciate if someone can give enlightment about my case...
Comments: ** Comment from web user: odheey **
inner exception : Not enough data (0) to read requested (1) bytes