Skip to main content

ZipArchive Class

The central object of the library - a package of entries containing compressed data.

Namespace: DevExpress.Compression

Assembly: DevExpress.Docs.v24.1.dll

NuGet Package: DevExpress.Document.Processor

Declaration

public class ZipArchive :
    IZipItemOwner,
    IEnumerable,
    IEnumerable<ZipItem>,
    IDisposable

Remarks

The ZipArchive is a package of entries which are the ZipItem descendants. To access an individual entry by its index or a name, use the ZipArchive.Item property.

If you create a new archive, create the ZipArchive instance by using a constructor. To ensure that the zip archive instance will be correctly disposed of, call the constructor within the using statement. When a new instance of the zip archive is created, you can add entries by calling the methods specific for each source type.

Source Type Method Entry Type
File ZipArchive.AddFile ZipFileItem
Directory ZipArchive.AddDirectory ZipFileItem
Stream ZipArchive.AddStream ZipStreamItem
Text ZipArchive.AddText ZipTextItem
Array of Bytes ZipArchive.AddByteArray ZipByteArrayItem

To extract archive content, use the static method ZipArchive.Read. The method creates a ZipArchive instance, and you can call the ZipArchive.Extract method for the entire archive or the ZipItem.Extract method for each zip item.

To update the archive, create an instance of the ZipArchive class using the ZipArchive.Read method, modify it as required and save it using the ZipArchive.Save method.

You can control the process of adding files to the archive by handling the ZipArchive.ItemAdding event. To control the process of compressing and saving the archive (and to interrupt it when required), handle the ZipArchive.Progress event.

Inheritance

Object
ZipArchive
See Also