ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Standard functions / Archive functions
  • Error codes
  • Compression level and addition time
  • Notes
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Changes the compression level used when creating an archive in ZIP format or in 7z format.
Example
WINDEVWEBDEV - Server codeReports and QueriesAjax
NumErrZip is int
MonArchive is zipArchive

// Création de l'archive "MonArchive"
NumErrZip = zipCreate(MonArchive, "C:\MesDocuments\Archive.zip")
IF NumErrZip <> 0 THEN
	Error(zipMsgError(NumErrZip))
	RETURN
END

// Ajout d'un fichier au taux de compression par défaut (6)
NumErrZip = zipAddFile(MonArchive, "C:\MesImages\Image1.jpg", zipNone)
IF NumErrZip <> 0 THEN
	Error(zipMsgError(NumErrZip) + "Sur le fichier " + zipCurrentFile(MonArchive))
END

// Changement du taux de compression
// Le prochain fichier sera simplement stocké (aucune compression)
zipCompressionLevel(MonArchive, 0)

// Ajout d'un fichier
NumErrZip = zipAddFile(MonArchive, "C:\MesImages\Image2.jpg", zipNone)
IF NumErrZip <> 0 THEN
	Error(zipMsgError(NumErrZip) + "Sur le fichier " + zipCurrentFile(MonArchive))
END
Syntax
<Result> = zipCompressionLevel(<Archive> , <Compression level>)
<Result>: Integer
  • 0 if the compression level was changed,
  • An error code (value greater than 0) otherwise (see the Notes).
<Archive>: Character string or zipArchive variable
Name of the archive to be used.
This name can correspond to:
<Compression level>: Integer
Value included between 0 (storage without compression) and 9 (maximum compression).
The default compression level is set to 6.
Remarks

Error codes

The following error codes are returned:
  • 15: CAB format archive.
  • 27: Archive in WDZ format.
  • 28: Invalid compression level.
The message corresponding to the error code is returned by zipMsgError.

Compression level and addition time

Caution: The higher the compression level, the longer it will take to add a file to the archive.

Notes

The compression level is defined by the call to the function for all the files that will be added to the archive thereafter (the compression level for the files already found in the archive remains the same).
Please note It is not possible to change the compression level of a file in an existing archive.
Business / UI classification: Business Logic
Component: wd300zip.dll
Minimum version required
  • Version 11
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/28/2025

Send a report | Local help