Quantcast
Channel: NPOI
Viewing all articles
Browse latest Browse all 1621

Created Unassigned: calculated end index (3148) is out of allowable range (3121..3126) [12698]

$
0
0
Hi, I'm learning how to use NPOI, but I'm having some trouble i just can't figure out.

running this very simple snippet gives me a exception at the line "wb.Write(fsOut);"

"An unhandled exception of type 'System.ArgumentException' occurred in NPOI.dll

Additional information: calculated end index (3148) is out of allowable range (3121..3126)"

```
static void Main(string[] args)
{
using (FileStream fs = File.OpenRead(@"C:\Users\Mads\Desktop\TestSheet.xls"))
{
IWorkbook wb = WorkbookFactory.Create(fs);
Console.WriteLine("Value of Cell B2: " + wb.GetSheetAt(0).GetRow(1).GetCell(1));
Console.WriteLine(wb.NumberOfSheets);
Console.WriteLine(wb.GetSheetName(0));
ISheet ws = wb.CloneSheet(0);

wb.Add(ws);

FileStream fsOut = new FileStream(@"C:\Users\Mads\Desktop\TestSheet2.xls", FileMode.Create);
wb.Write(fsOut);
fsOut.Close();
//wb.CreateSheet("new sheet name");
}
Console.Read();
}
```

Viewing all articles
Browse latest Browse all 1621

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>