在vb.net中压缩ExcelPackage

时间:2017-07-20 19:43:17

标签: asp.net .net vb.net

我在代码中创建了一个excel文档,我正在尝试使用ZipArchive压缩文件。我试图通过使用BinaryReader / Writers来做到这一点,但我试图制作的流似乎不包含任何内容。我有什么想法吗?

Using zip As ZipArchive = New ZipArchive(MemoryStream, ZipArchiveMode.Create, True)
            Dim excelFile As ZipArchiveEntry = zip.CreateEntry("QueryExportTest.xlsx")
            Using writer As BinaryWriter = New BinaryWriter(excelFile.Open())
                Dim excelReader As BinaryReader = New BinaryReader(excel.Stream())

                While excelReader.PeekChar() <> -1
                    writer.Write(excelReader.ReadBoolean)
                End While
            End Using
        End Using
之前使用Dim excel As New ExcelPackage()

定义了

excel

0 个答案:

没有答案