Get Document Properties in NPOI
Contents
[
Hide
]
Aspose.Words - Get Document Properties
Document properties allow some useful information to be stored along with the document. There are system (built-in) and user defined (custom) properties. Built-in properties contain such things as document title, author’s name, document statistics, and so on. Custom properties are just name-value pairs where user defines both the name and value.
You can use document properties in your document automation project to store some useful info along with the document such as when the document was received/processed/time stamped and so on.
C#
Document doc = new Document("Get Document Properties.doc");
foreach (DocumentProperty prop in doc.BuiltInDocumentProperties)
{
Console.WriteLine(prop.Name+": "+ prop.Value);
}
NPOI HWPF XWPF - Get Document Properties
C#
SummaryInformation summaryInfo = new SummaryInformation(new PropertySet(new FileStream("Get Document Properties.doc", FileMode.Open)));
Console.WriteLine(summaryInfo.ApplicationName);
Console.WriteLine(summaryInfo.Author);
Console.WriteLine(summaryInfo.Comments);
Console.WriteLine(summaryInfo.CharCount);
Console.WriteLine(summaryInfo.EditTime);
Console.WriteLine(summaryInfo.Keywords);
Console.WriteLine(summaryInfo.LastAuthor);
Console.WriteLine(summaryInfo.PageCount);
Console.WriteLine(summaryInfo.RevNumber);
Console.WriteLine(summaryInfo.Security);
Console.WriteLine(summaryInfo.Subject);
Console.WriteLine(summaryInfo.Template);
Download Running Code
Download Get Document Properties from any of the below mentioned social coding sites:
Download Sample Code
Download Get Document Properties from any of the below mentioned social coding sites: