Concepts
Document Metadata
Structured data that describes the contents of a document.
Document metadata provides a way to summarize the contents of a document. This data is typically used in document management systems to better facilitate searching. Metadata is stored in the document and can be viewed in word processors by inspecting the document properties.
WordDocument.Create(savePath, document =>
{
document.Metadata(new DocumentMetadata
{
Title = "Invoice #867",
Description = "An invoice for services rendered to ACME, Inc.",
Subject = "ACME, Inc.",
Category = "Invoice",
Keywords = "invoice, services, payment",
Creator = "MyApplication",
CreationDate = DateTime.Now,
ModifiedDate = DateTime.Now
});
document.Section(section =>
{
section.Paragraph("Your invoice content");
});
});
Standard Properties
The following table lists the standard set of properties that can be assigned to a document:
| Property | Description |
|---|---|
Title | The main heading or name of the document. |
Description | An explanation/summary of the document content. |
Subject | The main topic related to the document content. |
Category | The document category, e.g., "Resume", "Proposal", "Specification", etc. |
Keywords | A collection of terms or phrases that describe the document's content or purpose, improving categorization and searchability. The value should be a string containing the terms/phrases delimited with a comma. |
Creator | The name of the individual, organization, or software that is responsible for creating the document. |
Company | The name of the company associated with the document. |
Manger | The name of the manager/supervisor associated with the document. |
CreationDate | The date and time the document was created. |
ModifiedDate | The date and time the document was last updated/revised. |
Custom Properties
Custom properties can also be defined:
document.Metadata(new DocumentMetadata
{
CustomProperties = new Dictionary<string, object> {
{ "Customer ID", 986 },
{ "Customer Name", "ACME, Inc." },
{ "Customer Contact": "Will E. Coyote" },
{ "Issue Date", DateTime.Now },
{ "Standard Warranty", true }
}
});
The keys of the dictionary are the names of the custom properties. The values
can be a bool, string, number (i.e., a
float, double, decimal, etc.), or
DateTime. All other value types are converted to a string before
assignment.