I'm trying to use the NPOI library in a winforms app. I have referenced the latest NPOI dll in my project and tried to reproduce the examples gave by NPOI and found on SO:
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet sheet = workbook.CreateSheet("Sheet1");
HSSFRow headerRow = sheet.CreateRow(0);
But this won't compile on my machine because HSSFWorkbook.CreateSheet()
returns a NPOI.SS.UserModel.Sheet
instead of a NPOI.SS.UserModel.HSSFSheet
.
What am I missing here ?
Try the following:
Sheet sheet = workbook.CreateSheet("Sheet1");
Row headerRow = sheet.CreateRow(0);
And include the namespace NPOI.SS.UserModel
Sheet
and Row
are actually interfaces, but don't have the I
prefix (I presume) because this library is a port from Java.