officefileapi-devexpress-dot-compression-dot-zipitem-01c6b8be.md
Gets or sets a text comment for the zip item.
Namespace : DevExpress.Compression
Assembly : DevExpress.Docs.v25.2.dll
NuGet Package : DevExpress.Document.Processor
public string Comment { get; set; }
Public Property Comment As String
| Type | Description |
|---|---|
| String |
A string that is stored in an archive as a comment to the zip item.
|
This example adds a text comment to each zip item in the archive that indicates the person who is currently logged on.
using DevExpress.Compression;
//...
public void ArchiveWithComment() {
string path = this.startupPath;
using (ZipArchive archive = new ZipArchive()) {
foreach (string file in System.IO.Directory.EnumerateFiles(path)) {
ZipFileItem zipFI = archive.AddFile(file, "/");
zipFI.Comment = "Archived by " + Environment.UserName;
}
archive.Save("ArchiveWithComment.zip");
}
}
Imports DevExpress.Compression
Public Sub ArchiveWithComment()
Dim path As String = Me.startupPath
Using archive As New ZipArchive()
For Each file As String In System.IO.Directory.EnumerateFiles(path)
Dim zipFI As ZipFileItem = archive.AddFile(file, "/")
zipFI.Comment = "Archived by " & Environment.UserName
Next file
archive.Save("ArchiveWithComment.zip")
End Using
End Sub
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Comment property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
zip-compression-and-archive-api-examples/CS/CompressionLibraryExamples/ZipExamples.cs#L146
ZipFileItem zipFI = archive.AddFile(file, "/");
zipFI.Comment = "Archived by " + Environment.UserName;
}
zip-compression-and-archive-api-examples/VB/CompressionLibraryExamples/ZipExamples.vb#L151
Dim zipFI As ZipFileItem = archive.AddFile(file, "/")
zipFI.Comment = "Archived by " & Environment.UserName
Next file
See Also