This API release introduces the support for the high compression ratio 7z
archive file format. This format supports numerous compression methods, such as, Deflate, PPMD, BCJ, BZIP, LZMA, etc.
Our Parser API helps you extract images, and get attachments from containers. The following C# code sample demonstrates how to do text extraction from 7z
entities via API:
// Create an instance of Parser class
using (Parser parser = new Parser(filePath))
{
// Extract attachments from the container
IEnumerable<ContainerItem> attachments = parser.GetContainer();
// Check if container extraction is supported
if (attachments == null)
{
Console.WriteLine("Container extraction isn't supported");
}
// Iterate over 7z entities
foreach (ContainerItem item in attachments)
{
// Print the file path
Console.WriteLine(item.FilePath);
try
{
// Create Parser object for the 7z entity content
using (Parser attachmentParser = item.OpenParser())
{
// Extract an 7z entity text
using (TextReader reader = attachmentParser.GetText())
{
Console.WriteLine(reader == null ? "No text" : reader.ReadToEnd());
}
}
}
catch (UnsupportedDocumentFormatException)
{
Console.WriteLine("Isn't supported.");
}
}
}
Ability to perform attachment extraction from Word® documents, PowerPoint® presentations, and Excel® spreadsheets.
The following C# code snippet can be used to parse and extract text from document attachments via API:
// Create an instance of Parser class
using (Parser parser = new Parser(filePath))
{
// Extract attachments from the container
IEnumerable<ContainerItem> attachments = parser.GetContainer();
// Check if container extraction is supported
if (attachments == null)
{
Console.WriteLine("Container extraction isn't supported");
}
// Iterate over attachment entities
foreach (ContainerItem item in attachments)
{
// Print the file path
Console.WriteLine(item.FilePath);
try
{
// Create Parser object for the attachment entity content
using (Parser attachmentParser = item.OpenParser())
{
// Extract an attachment entity text
using (TextReader reader = attachmentParser.GetText())
{
Console.WriteLine(reader == null ? "No text" : reader.ReadToEnd());
}
}
}
catch (UnsupportedDocumentFormatException)
{
Console.WriteLine("Isn't supported.");
}
}
}
For a complete list of features, enhancements, and bug fixes in this release please visit, GroupDocs.Parser for .NET 22.8 Release Notes.