I've been testing NPOI 1.2.3 for populating various Excel templates. It was working fine, but after I made a change to one of the excel templates, I'm getting this error:
Duplicate PageSettingsBlock record (sid=0x12)
The error happens right at line 2 below:
Dim fs As New FileStream(Server.MapPath("xls\myTemplate.xls"), FileMode.Open, FileAccess.Read)
Dim workbook As New HSSFWorkbook(fs, True)
I've seen a discussion here that mentions NPOI 1.2.4 as being a fix http://npoi.codeplex.com/discussions/252132, but 1.2.4 is currently in Alpha.
Maybe I'll end up just using 1.2.4, but does anyone know the possible causes of this error? What could I have edited in the XLS file that would cause the error to occur?
Update: After downloading the Alpha 1.2.4 release at http://code.google.com/p/npoi/downloads/list, the problem stopped. Still, it would be nice to know the cause of the error in 1.2.3.
This is a bug introduced in NPOI 1.2.3, which didn't migrate the new pagesettingsblock from POI 3.6/3.7 correctly. It was fixed in NPOI 1.2.4