Класс PptxDocumentMetadata
В этом разделе
Представляет собой корневой узел дерева, в котором хранятся метаданные документа PPTX.
Объектная модель
Синтаксис
Пример
Вот пример, демонстрирующий получение информации о документе PPTX из дерева метаданных:
''' <summary>
''' Shows information about PPTX document from metadata tree.
''' </summary>
''' <param name="pptxFilename">A name of PPTX file.</param>
Public Shared Sub ShowPptxDocumentInfoFromMetadataTree(pptxFilename As String)
' create image collection
Using images As New Vintasoft.Imaging.ImageCollection()
' add PPTX document to the image collection
images.Add(pptxFilename)
' if image collection has images/pages
If images.Count > 0 Then
' get the first image/page
Dim firstImage As Vintasoft.Imaging.VintasoftImage = images(0)
' get PptxDocumentMetadata object from the metadata tree of PPTX decoder
Dim pptxDocumentMetadata As Vintasoft.Imaging.Metadata.PptxDocumentMetadata = TryCast(firstImage.SourceInfo.Decoder.GetDocumentMetadata(), Vintasoft.Imaging.Metadata.PptxDocumentMetadata)
' if PptxDocumentMetadata object is found
If pptxDocumentMetadata IsNot Nothing Then
' get PPTX document from PptxDocumentMetadata object
Dim pptxDocument As Vintasoft.Imaging.Office.OpenXml.Pptx.PptxDocument = pptxDocumentMetadata.Document
' show information about PPTX document
System.Console.WriteLine(String.Format("PPTX document ""{0}"" information:", pptxFilename))
System.Console.WriteLine(String.Format(" - Page count: {0}", pptxDocument.Pages.Count))
System.Console.WriteLine(String.Format(" - Category: {0}", pptxDocument.DocumentInformation.Category))
System.Console.WriteLine(String.Format(" - ContentStatus: {0}", pptxDocument.DocumentInformation.ContentStatus))
System.Console.WriteLine(String.Format(" - ContentType: {0}", pptxDocument.DocumentInformation.ContentType))
System.Console.WriteLine(String.Format(" - Created: {0}", pptxDocument.DocumentInformation.Created))
System.Console.WriteLine(String.Format(" - Creator: {0}", pptxDocument.DocumentInformation.Creator))
System.Console.WriteLine(String.Format(" - Description: {0}", pptxDocument.DocumentInformation.Description))
System.Console.WriteLine(String.Format(" - Identifier: {0}", pptxDocument.DocumentInformation.Identifier))
System.Console.WriteLine(String.Format(" - Keywords: {0}", pptxDocument.DocumentInformation.Keywords))
System.Console.WriteLine(String.Format(" - Language: {0}", pptxDocument.DocumentInformation.Language))
System.Console.WriteLine(String.Format(" - LastModifiedBy: {0}", pptxDocument.DocumentInformation.LastModifiedBy))
System.Console.WriteLine(String.Format(" - LastPrinted: {0}", pptxDocument.DocumentInformation.LastPrinted))
System.Console.WriteLine(String.Format(" - Modified: {0}", pptxDocument.DocumentInformation.Modified))
System.Console.WriteLine(String.Format(" - Revision: {0}", pptxDocument.DocumentInformation.Revision))
System.Console.WriteLine(String.Format(" - Subject: {0}", pptxDocument.DocumentInformation.Subject))
System.Console.WriteLine(String.Format(" - Title: {0}", pptxDocument.DocumentInformation.Title))
System.Console.WriteLine(String.Format(" - Version: {0}", pptxDocument.DocumentInformation.Version))
End If
images.ClearAndDisposeItems()
End If
End Using
End Sub
/// <summary>
/// Shows information about PPTX document from metadata tree.
/// </summary>
/// <param name="pptxFilename">A name of PPTX file.</param>
public static void ShowPptxDocumentInfoFromMetadataTree(string pptxFilename)
{
// create image collection
using (Vintasoft.Imaging.ImageCollection images = new Vintasoft.Imaging.ImageCollection())
{
// add PPTX document to the image collection
images.Add(pptxFilename);
// if image collection has images/pages
if (images.Count > 0)
{
// get the first image/page
Vintasoft.Imaging.VintasoftImage firstImage = images[0];
// get PptxDocumentMetadata object from the metadata tree of PPTX decoder
Vintasoft.Imaging.Metadata.PptxDocumentMetadata pptxDocumentMetadata =
firstImage.SourceInfo.Decoder.GetDocumentMetadata() as Vintasoft.Imaging.Metadata.PptxDocumentMetadata;
// if PptxDocumentMetadata object is found
if (pptxDocumentMetadata != null)
{
// get PPTX document from PptxDocumentMetadata object
Vintasoft.Imaging.Office.OpenXml.Pptx.PptxDocument pptxDocument =
pptxDocumentMetadata.Document;
// show information about PPTX document
System.Console.WriteLine(string.Format("PPTX document \"{0}\" information:", pptxFilename));
System.Console.WriteLine(string.Format(" - Page count: {0}", pptxDocument.Pages.Count));
System.Console.WriteLine(string.Format(" - Category: {0}", pptxDocument.DocumentInformation.Category));
System.Console.WriteLine(string.Format(" - ContentStatus: {0}", pptxDocument.DocumentInformation.ContentStatus));
System.Console.WriteLine(string.Format(" - ContentType: {0}", pptxDocument.DocumentInformation.ContentType));
System.Console.WriteLine(string.Format(" - Created: {0}", pptxDocument.DocumentInformation.Created));
System.Console.WriteLine(string.Format(" - Creator: {0}", pptxDocument.DocumentInformation.Creator));
System.Console.WriteLine(string.Format(" - Description: {0}", pptxDocument.DocumentInformation.Description));
System.Console.WriteLine(string.Format(" - Identifier: {0}", pptxDocument.DocumentInformation.Identifier));
System.Console.WriteLine(string.Format(" - Keywords: {0}", pptxDocument.DocumentInformation.Keywords));
System.Console.WriteLine(string.Format(" - Language: {0}", pptxDocument.DocumentInformation.Language));
System.Console.WriteLine(string.Format(" - LastModifiedBy: {0}", pptxDocument.DocumentInformation.LastModifiedBy));
System.Console.WriteLine(string.Format(" - LastPrinted: {0}", pptxDocument.DocumentInformation.LastPrinted));
System.Console.WriteLine(string.Format(" - Modified: {0}", pptxDocument.DocumentInformation.Modified));
System.Console.WriteLine(string.Format(" - Revision: {0}", pptxDocument.DocumentInformation.Revision));
System.Console.WriteLine(string.Format(" - Subject: {0}", pptxDocument.DocumentInformation.Subject));
System.Console.WriteLine(string.Format(" - Title: {0}", pptxDocument.DocumentInformation.Title));
System.Console.WriteLine(string.Format(" - Version: {0}", pptxDocument.DocumentInformation.Version));
}
images.ClearAndDisposeItems();
}
}
}
Иерархия наследования
Требования
Целевые платформы: .NET 11; .NET 10; .NET 9; .NET 8; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5
Смотрите также