Created
August 10, 2022 07:41
-
-
Save conholdate-docs-gists/89b2dc909b7ef35cce4e0477f5042244 to your computer and use it in GitHub Desktop.
View metadata of a document | https://docs.conholdate.com/net/view-metadata
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Constants.InputXlsx is an absolute or relative path to your document. Ex: @"C:\Docs\source.xlsx" | |
using (Metadata metadata = new Metadata(Constants.InputXlsx)) | |
{ | |
if (metadata.FileFormat != FileFormat.Unknown) | |
{ | |
IDocumentInfo info = metadata.GetDocumentInfo(); | |
Console.WriteLine("File format: {0}", info.FileType.FileFormat); | |
Console.WriteLine("File extension: {0}", info.FileType.Extension); | |
Console.WriteLine("MIME Type: {0}", info.FileType.MimeType); | |
Console.WriteLine("Number of pages: {0}", info.PageCount); | |
Console.WriteLine("Document size: {0} bytes", info.Size); | |
Console.WriteLine("Is document encrypted: {0}", info.IsEncrypted); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Read the complete article: https://docs.conholdate.com/net/view-metadata