Home Forums .NET libraries Xceed Zip & Real-Time Zip for .NET Load password protected docx with Xceed (DS-40655)

Affichage de 1 message (sur 1 au total)
  • Auteur
  • DorShaar
    Post count: 2
    #50608 |

    Hello Xceed,

    I created a simple password protected docx file with office.
    I try to load it with your Xceed.Zip and Xceed.Words.NET but I fail to do so with both of them.

    // Using Xceed.Zip (Ver 4.9.15601.10520 dll)
    using (FileStream zipFileStream = File.OpenRead(<docxFilePath>))
    StreamFile streamFile = new StreamFile(zipFileStream);
    ZipArchive zipArchive = ZipArchive(streamFile)
    DefaultEncryptionPassword = « 1234 »,
    DefaultDecryptionPassword = « 1234 »

    I get the next exception:
    using Xceed.Zip:
    at Xceed.Zip.ZipHandler.ReadEndHeader(BinaryReader reader, Stream stream, ISpannedStream spannedStream)
    at Xceed.Zip.ZipStorage.DoReadItems(FileSystemEventsSession session, ReadItemsSession readItemsSession, Stream source, ISpannedStream spannedStream)
    at Xceed.Utils.Storage.Storage.ReadItems(FileSystemEventsSession session, Stream source)
    at Xceed.Utils.Storage.StorageHandler.Refresh(FileSystemEventsSession session, Boolean forceRefresh)
    at Xceed.Zip.ZipHandler.GetZipHandler(FileSystemEventsSession session, AbstractFile zipFile)
    at Xceed.Zip.ZippedFolder..ctor(FileSystemEvents events, Object userData, AbstractFile zipFile, String folderName)
    at Xceed.Zip.ZipArchive..ctor(FileSystemEvents events, Object userData, AbstractFile zipFile)

    // Using Xceed.Words.NET (Ver 1.5.18313.21000)
    using (DocX xceedDocx = DocX.Load(<docxFilePath>))
    // does not reach here

    I get the next exception:
    File contains corrupted data.
    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 Xceed.Document.NET.Document.Load(String filename, Document document, DocumentTypes documentType)
    at Xceed.Words.NET.DocX.Load(String filename).

    Please guide me how to load password protected files with your SKD’s.
    Thank you,


Affichage de 1 message (sur 1 au total)
  • Vous devez être connecté pour répondre à ce sujet.