Xceed Zip Compression Library Documentation
Zip method
Xceed Zip control reference > Xceed Zip control methods > Zip method

VB example Delphi example VC++ example

Description

The Zip method compresses and stores files into a new or existing zip file.

The zip file to be written to must be specified by setting the ZipFilename property. When you run the Zip method, if the specified zip file does not exist, a new one will be created.

The files to zip up must be specified by setting the FilesToProcess property.

Declaration (ActiveX)  
Method Zip() As xcdError 
Declaration (DLL API)  
int XzZip( HXCEEDZIP hZip ) 

Return values

A return value of type xcdError is returned. Only the return value of xerSuccess indicates that the method has been completed successfully. See the error codes topic for a list of possible return values.

Remarks

If one or more files to zip up already exist in the zip file being written to, the files already in the zip file will be replaced with new ones - unless one of the filtering properties causes the file to be excluded from processing.

To encrypt the contents of the zip file, the EncryptionPassword property must be set. If neither the EncryptionMethod or EncryptionStrength properties have been set, the zip file will be encrypted using the "standard" zip file encryption. To encrypt the zip file using WinZip AES compatible encryption algorithm, the EncryptionMethod property must be set to xemWinZipAES and the EncryptionStrength property set to the desired encryption strength, by default 256 bits.

Applicable properties

Abort, BasePath, CompressionLevel, DeleteZippedFiles, EncryptionPassword, EncryptionMethod, EncryptionStrength,  FilesToProcess and the filtering properties, SplitSize, PreservePaths, ProcessSubfolders, the SkipIf* properties, TempFolder, UseTempFile, ZipFilename, SpanMultipleDisks, ExtraHeaders, ZipOpenedFiles and the Sfx* properties.

Events triggered

ZipPreprocessingFile, DeletingFile, FileStatus, GlobalStatus, QueryMemoryFile, InsertDisk, DiskNotEmpty, ZipComment, ZippingMemoryFile, Warning, SkippingFile, InvalidPassword, and ProcessCompleted.

Related topics

If you want to create spanned zip files , refer to the SpanMultipleDisks property.

Things you should consider