Back to Devexpress

ZipArchive Class

officefileapi-devexpress-dot-compression-4ffc0dd4.md

latest5.0 KB
Original Source

ZipArchive Class

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

Namespace : DevExpress.Compression

Assembly : DevExpress.Docs.v25.2.dll

NuGet Package : DevExpress.Document.Processor

Declaration

csharp
[DXLicenseDocs]
public class ZipArchive :
    IZipItemOwner,
    IEnumerable,
    IEnumerable<ZipItem>,
    IDisposable
vb
<DXLicenseDocs>
Public Class ZipArchive
    Implements IZipItemOwner,
               IEnumerable,
               IEnumerable(Of ZipItem),
               IDisposable

The following members return ZipArchive objects:

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 TypeMethodEntry Type
FileZipArchive.AddFileZipFileItem
DirectoryZipArchive.AddDirectoryZipFileItem
StreamZipArchive.AddStreamZipStreamItem
TextZipArchive.AddTextZipTextItem
Array of BytesZipArchive.AddByteArrayZipByteArrayItem

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.

Implements

IEnumerable<ZipItem>

IEnumerable

IDisposable

Inheritance

Object ZipArchive

See Also

ZipArchive Members

Zip Compression and Archive API Examples

DevExpress.Compression Namespace