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:

PropertyDescription
TitleThe main heading or name of the document.
DescriptionAn explanation/summary of the document content.
SubjectThe main topic related to the document content.
CategoryThe document category, e.g., "Resume", "Proposal", "Specification", etc.
KeywordsA 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.
CreatorThe name of the individual, organization, or software that is responsible for creating the document.
CompanyThe name of the company associated with the document.
MangerThe name of the manager/supervisor associated with the document.
CreationDateThe date and time the document was created.
ModifiedDateThe 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.