解压缩错误 - 意外结束 - 使用ziparchive
我得到了以下代码:
Dim ms = New MemoryStream()
CustomReportVorlage.ExportToPdf(ms)
Dim bt2 = ms.ToArray()
Dim outStream = New MemoryStream()
Dim archive = new ZipArchive(outStream, ZipArchiveMode.Create, False)
Dim fileInArchive = archive.CreateEntry(String.Concat(String.Concat("Zugangsdaten_",src(0)("KURZBEZEICHNUNG")), ".pdf"), CompressionLevel.NoCompression)
Dim entryStream = fileInArchive.Open()
Dim fileToCompressedStream as new MemoryStream(bt2, 0, ms.ToArray().Length)
fileToCompressedStream.CopyTo(entryStream)
fileToCompressedStream.Close()
archive.Dispose()
ms.Close()
outStream.Close()
Dim btFile = outStream.ToArray()
这有效,我可以解压缩文件等。但是我得到了“意外的结尾”,因此我可以在代码中解压缩文件。 如何解决?
I got the following Code:
Dim ms = New MemoryStream()
CustomReportVorlage.ExportToPdf(ms)
Dim bt2 = ms.ToArray()
Dim outStream = New MemoryStream()
Dim archive = new ZipArchive(outStream, ZipArchiveMode.Create, False)
Dim fileInArchive = archive.CreateEntry(String.Concat(String.Concat("Zugangsdaten_",src(0)("KURZBEZEICHNUNG")), ".pdf"), CompressionLevel.NoCompression)
Dim entryStream = fileInArchive.Open()
Dim fileToCompressedStream as new MemoryStream(bt2, 0, ms.ToArray().Length)
fileToCompressedStream.CopyTo(entryStream)
fileToCompressedStream.Close()
archive.Dispose()
ms.Close()
outStream.Close()
Dim btFile = outStream.ToArray()
This works, I can unzip my file, etc. But I get "unexpected end" and due to that I can´t unzip the file in code.
How to solve that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议您将7zip.exe与shell一起使用(“ 7zip.exe -extract ...”)
如果这对您有帮助,请接受我的答案
i suggest you to use the 7zip.exe with Shell("7zip.exe -extract...")
if this has helped you, accept my answer