Thanks to visit codestin.com
Credit goes to github.com

Skip to content

FetchAsync<T> throws NPOI.OpenXml4Net.Exceptions.InvalidFormatException : Your InputStream was neither an OLE2 stream, nor an OOXML stream #331

@Cynicszm

Description

@Cynicszm

Hi,

We are using ExcelMapper 6.0.612 and NPOI 2.7.5

When trying to load data from a stream using FetchAsync:

var queryXls = await new ExcelMapper().FetchAsync<MapExcel>( stream, "SheetName" );

We get the exception below:

NPOI.OpenXml4Net.Exceptions.InvalidFormatException : Your InputStream was neither an OLE2 stream, nor an OOXML stream
   at NPOI.SS.UserModel.WorkbookFactory.Create(Stream inputStream, String password)
   at NPOI.SS.UserModel.WorkbookFactory.Create(Stream inputStream)
   at Ganss.Excel.ExcelMapper.Fetch(Stream stream, Type type, String sheetName, Func`2 valueConverter)
   at Ganss.Excel.ExcelMapper.FetchAsync(Stream stream, Type type, String sheetName, Func`2 valueConverter)
   at Ganss.Excel.ExcelMapper.FetchAsync[T](Stream stream, String sheetName, Func`2 valueConverter)

If we use the NPOI FileMagicContainer.ValueOf(steam) the type is OOXML.

If we use the sync method Fetch below it works.
var queryXls = new ExcelMapper( stream ).Fetch<MapExcel>( "SheetName" );

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions