Utilisation de NPOI pour lire un fichier Excel
Bonjour
J'essaie de lire un fichier excel à laide de NPOI
Mais malherureusement j'ai l'erreur suivante
Citation:
Détails de l'exception: NPOI.POIFS.FileSystem.OfficeXmlFileException: The supplied data appears to be in the Office 2007+ XML. POI only supports OLE2 Office documents
Mon code est le suivant
Code:
1 2 3 4 5 6 7 8 9
| Dim fs As New FileStream(Server.MapPath("..\Temp\excel\xxx.xlsx"), FileMode.Open, FileAccess.Read)
Dim templateWorkbook As New HSSFWorkbook(fs, True)
Dim sheet As HSSFSheet = templateWorkbook.GetSheet("Objectif")
For row As Integer = 0 To sheet.LastRowNum
If sheet.GetRow(row) IsNot Nothing Then
Response.Write(sheet.GetRow(row).GetCell(0).StringCellValue)
End If
Next |
l'erreur est au niveau de la ligne
Code:
Dim templateWorkbook As New HSSFWorkbook(fs, True)