This demo uses the DevExpress Presentation API to extract presentation metadata. You can use the predefined sample file or upload your own presentation. To do the latter, select Upload a File in the file selection drop-down menu.
Check the required boxes to specify the metadata types to extract. Click Extract Metadata to proceed and download the result.
Sample document
Sample.pptx
using System.Text;
using DevExpress.Docs.Presentation;
string ReadDocumentPropertiest(Stream inputStream, bool readDocumentProperties, bool readCustomProperties) {
var output = new StringBuilder();
using var presentation = new Presentation(inputStream);
if(readDocumentProperties) {
var coreProperties = presentation.DocumentProperties;
output.AppendLine("CORE DOCUMENT PROPERTIES:");
output.AppendLine(new string('-', 30));
output.AppendLine($"Title: {coreProperties.Title ?? ""}");
output.AppendLine($"Author: {coreProperties.Author ?? ""}");
output.AppendLine($"Subject: {coreProperties.Subject ?? ""}");
output.AppendLine($"Keywords: {coreProperties.Keywords ?? ""}");
output.AppendLine($"Category: {coreProperties.Category ?? ""}");
output.AppendLine($"Company: {coreProperties.Company ?? ""}");
output.AppendLine($"Manager: {coreProperties.Manager ?? ""}");
output.AppendLine($"Created Date: {coreProperties.Created.ToString("yyyy-MM-dd HH:mm:ss")}");
output.AppendLine($"Last Printed: {coreProperties.Printed.ToString("yyyy-MM-dd HH:mm:ss")}");
output.AppendLine();
}
if(readCustomProperties) {
var customProperties = presentation.DocumentProperties.CustomProperties;
output.AppendLine("CUSTOM PROPERTIES:");
output.AppendLine(new string('-', 30));
var hasCustomProperties = false;
var customPropsList = new List<string>();
foreach(string propName in customProperties.Keys) {
hasCustomProperties = true;
var propValue = customProperties[propName];
var valueStr = propValue.ToString() ?? "";
var typeStr = propValue.GetType().Name ?? "String";
customPropsList.Add($"{propName}: {valueStr} ({typeStr})");
}
if(!hasCustomProperties)
output.AppendLine("No custom properties found.");
else
foreach(var customProp in customPropsList)
output.AppendLine(customProp);
output.AppendLine();
}
return output.ToString();
}