Quantcast
Channel: npoi Discussions Rss Feed
Viewing all articles
Browse latest Browse all 637

New Post: EOF In Header exception when reading .xlsm

$
0
0
Thank you @timclaason,
yes, you're right with the stream reading, thats the problem of code re-using. Anyway I'm trying other XSSFWorkBook() with no luck, for example this with NPOI.OpenXml4Net.OPC.OPCPackage.
try
{
    HttpPostedFile postedFile = null;
    string searchForFileName = Path.GetFileName(properties.BeforeUrl);
    HttpFileCollection collection = _context.Request.Files;
    NPOI.OpenXml4Net.OPC.OPCPackage xlsxPackage = null;

    for (int i = 0; i < collection.Count; i++)
    {
        postedFile = collection[i];
        if (searchForFileName.Equals(Path.GetFileName(postedFile.FileName), StringComparison.OrdinalIgnoreCase))
        {
            xlsxPackage = NPOI.OpenXml4Net.OPC.OPCPackage.Open(postedFile.InputStream);
        }
    }
    return new XSSFWorkbook(xlsxPackage);
}
catch (Exception ex)
{
    return null;
    throw ex;
}
I will try with other different constructors, thanks.

Viewing all articles
Browse latest Browse all 637

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>