GroupDocs.Metadata for .NET

Update Metadata Of Docx File In C#

Update metadata information from all popular documents, images and multimedia file formats with the support of performing all most-needed metadata processing operations.

Steps for Updating Metadata to DOCX in C#

GroupDocs.Metadata for .NET makes it easy for .NET developers to edit metadata information to DOCX files from within their applications by implementing a few easy steps.

  1. Load DOCX file via an instance of Metadata class.
  2. Specify a predicate that will be used to filter desired metadata properties.
  3. Pass the predicate and the new value to the UpdateProperties method.
  4. Save the changes to disc in DOCX format.
Copy
// Edit DOCX creation date

using (var metadata = new GroupDocs.Metadata.Metadata("input.docx"))
{
    // set the value of each property that satisfies the predicate::
    // property contains the date/time the document was created
    // update the file creation date/time if the existing value is older than 3 days
    var affected = metadata.UpdateProperties(
      p => p.Tags.Contains(GroupDocs.Metadata.Tagging.Tags.Time.Created) &&
      p.Value.Type == GroupDocs.Metadata.Common.MetadataPropertyType.DateTime &&
      p.Value.ToStruct() < DateTime.Today.AddDays(-3), new GroupDocs.Metadata.Common.PropertyValue(DateTime.Today));

    Console.WriteLine("Properties set: {0}", affected);

    // Save result DOCX
    metadata.Save("output.docx");
}
dotnet add package GroupDocs.Metadata
click to copy
copied
More examples Documentation

Manage DOCX Inner Metadata Properties for .NET Apps

The GroupDocs.Metadata API lets developers easily edit document details (metadata) in various formats using their .NET applications. Programmatically add, update, search for, and remove document properties.

Document Metadata Property Management

Effective Metadata Integration

GroupDocs.Metadata simplifies adding different properties to documents and files within your .NET apps. Developers can easily apply, update, or remove document properties programmatically.

Precise Metadata Control

The API offers extensive options for managing document properties. Developers can efficiently find and process any hidden data placed in business files.

Leveraging Built-in DOCX Properties

Depending on the document format, developers can utilize existing properties like EXIF data for images. This might include information like camera details, resolution, creation date, and more.

Update Lyrics Metadata in an MP3 File (Example)

This example demonstrates updating hidden information (metadata) in MP3 audio files.

C#


    //  Load file using the Metadata class
    using (Metadata metadata = new Metadata("input.mp3"))
    {
        var root = metadata.GetRootPackage<MP3RootPackage>();

        if (root.Lyrics3V2 == null)
        {
            root.Lyrics3V2 = new LyricsTag();
        }

        // Update lyrics data
        root.Lyrics3V2.Lyrics = "[00:01]Test lyrics";
        root.Lyrics3V2.Artist = "test artist";
        root.Lyrics3V2.Album = "test album";
        root.Lyrics3V2.Track = "test track";

        // {emore_features.code_1.comment_3}
        root.Lyrics3V2.Set(new LyricsField("ABC", "custom value"));

        // Save updated file
        metadata.Save("output.mp3");
    }

About GroupDocs.Metadata for .NET API

GroupDocs.Metadata for .NET offers an advanced set of metadata management features, allowing developers to easily read, doc, delete, find, compare, replace and export metadata information from images and document formats without using any external software. Use metadata manipulation API to edit metadata details from PDF, Microsoft Office Word, Excel spreadsheets, PowerPoint presentations, Outlook emails, OneNote, Visio, Project, AutoCAD, Archive and Multimedia file formats along with the support for working with many other metadata processing features.
Learn more
About illustration

Ready to get started?

Download GroupDocs.Metadata for free or get a trial license for full access!

Updating Metadata Properties From Other File Formats

Multi format documents and images metadata editing API for .NET. Retrieve metadata of some of the popular file formats as stated below

Temporary license tips

1
Sign up with your work email.
Free mail services are not allowed.
2
Use Get a temporary license button on the second step.
 English