The code below works with the error: "Extern sheet is part of LinkTable". I use NPOI 2.3.0 to work with Excel.

HSSFWorkbook xlsFile; using (var fileRead = new FileStream(FileName, FileMode.Open, FileAccess.Read)) { try { xlsFile = new HSSFWorkbook(fileRead); } catch (Exception ex) { MessageBox.Show(ex.Message); } } 

Tell me how to open this file using NPOI? Microsoft Office opens this file and can save it. After resave, the file size is reduced to a smaller side and NPOI easily opens this file.

But you need to work with NPOI. I tried to download the file through POIFS, and not immediately create an HSSFWorkbook object. But nothing sensible happened.

File with error: fileWithException

    1 answer 1

    Similar question. Maybe you can help. Response to ENG Stackoverflow

    Just in case, I will reprint if he suddenly gets lost.

    Reading example:

     using NPOI.HSSF.UserModel; using NPOI.SS.UserModel; //..... private void button1_Click(object sender, EventArgs e) { HSSFWorkbook hssfwb; using (FileStream file = new FileStream(@"c:\test.xls", FileMode.Open, FileAccess.Read)) { hssfwb= new HSSFWorkbook(file); } ISheet sheet = hssfwb.GetSheet("Arkusz1"); for (int row = 0; row <= sheet.LastRowNum; row++) { if (sheet.GetRow(row) != null) //null is when the row only contains empty cells { MessageBox.Show(string.Format("Row {0} = {1}", row, sheet.GetRow(row).GetCell(0).StringCellValue)); } } } 

    This link also contains a package of examples on NPIO.

    • No, this example does not apply to the error I described. The error appears in the line xlsFile = new HSSFWorkbook (fileRead); at creation of object and as a result xlsFile == null. Further work is impossible. I attached a sample file to my request, on which this error appears. - Alexander Telnov
    • on the official website also asked this question npoi.codeplex.com/workitem/14145 but since October 2017, as I understand it, support has ceased. - Alexander Telnov