Such information is stored in XXXPart.ContentType Property.
The following code can get a part of it, not a complete solution, but it should provide you with an idea.
public static void CreatePresentation(string filepath)
{
// Create a presentation at a specified file path. The presentation document type is pptx, by default.
PresentationDocument presentationDoc = PresentationDocument.Open(filepath,false);
PresentationPart presentationPart = presentationDoc.PresentationPart;
foreach (var item in presentationDoc.Parts)
{
Console.WriteLine(item.OpenXmlPart.ContentType);
}
Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~");
foreach (var slidePart in presentationPart.SlideParts)
{
Console.WriteLine(slidePart.ContentType);
}
presentationDoc.Close();
}
I have another idea, whether we can use the code to decompress it, then use the conventional method of reading Xml to read the content, and finally delete the decompressed file, I think this might be easier.
ZipFile.ExtractToDirectory Method
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.