Open Method Fails With MemoryStream

Posted by: 2strokesmoke on 23 July 2020, 2:53 am EST

  • Posted 23 July 2020, 2:53 am EST

    In Version the Workbook Open method fails to open a document from a memory stream stating that the 'File contains corrupted data.'. In Version the Workbook Open method opens from a memory stream without issue.

    Is opening from a memory stream in no longer supported or might this be an issue from an underlying component?

    Here is the stack trace from the issue:
    at MS.Internal.IO.Zip.ZipIOEndOfCentralDirectoryBlock.FindPosition(Stream archiveStream)
    at MS.Internal.IO.Zip.ZipIOEndOfCentralDirectoryBlock.SeekableLoad(ZipIOBlockManager blockManager)
    at MS.Internal.IO.Zip.ZipArchive..ctor(Stream archiveStream, FileMode mode, FileAccess access, Boolean streaming, Boolean ownStream)
    at MS.Internal.IO.Zip.ZipArchive.OpenOnStream(Stream stream, FileMode mode, FileAccess access, Boolean streaming)
    at System.IO.Packaging.ZipPackage..ctor(Stream s, FileMode mode, FileAccess access, Boolean streaming)
    at System.IO.Packaging.Package.Open(Stream stream, FileMode packageMode, FileAccess packageAccess, Boolean streaming)
    at ᯬ.ᜀ(Stream A_0)
    at ᣖ.ᜀ(ᢜ A_0, Stream A_1, ᬼ A_2)
    at ᢢ.ᜀ(ᬼ A_0, Stream A_1, ᬪ A_2, Boolean A_3)
    at GrapeCity.Documents.Excel.Workbook.OpenInternal(Stream fileStream, String password, OpenOptions openOptions, Boolean isMacroEnabled, Boolean digitalSignatureOnly)
    at GrapeCity.Documents.Excel.Workbook.Open(Stream fileStream, OpenOptionsBase options)
    at GrapeCityTableBindingDemo.BindTableExcel.BindThatTable() in C:\Users\ryanw\source\repos\GrapeCityTableBindingDemo\GrapeCityTableBindingDemo\BindTableExcel.vb:line 47
    at GrapeCityTableBindingDemo.Module1.Main() in C:\Users\ryanw\source\repos\GrapeCityTableBindingDemo\GrapeCityTableBindingDemo\Module1.vb:line 4

    Thank you for any help you can provide.
  • Marked as Answer

    Replied 23 July 2020, 7:40 pm EST

    Hi Ryan,

    In order to investigate this issue, we need the PDF file with which you are facing the issue and the code snippet that you are using to open the document.

    Note: If your pdf file is confidential then you can share it with us on our support portal SupportOne:

    Prabhat Sharma.
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels