Update Metadata from DOTX File in Java

Metadata Editor for Java applications – Change metadata fields from all popular documents, images and multimedia file formats using metadata editor API for Java.

Download Free Trial

About GroupDocs.Metadata for Java API

GroupDocs.Metadata for Java is an advanced metadata fields manipulation solution to easily read, add, modify, delete, search, compare, replace and export metadata information from images and document formats without using any external software. Edit metadata details from Word documents, Excel spreadsheets, PowerPoint presentations, Outlook emails, OneNote, Visio, Project, PDF, AutoCAD, ZIp, Audio and Video file formats along with the support for working with many other metadata processing features.

Steps for DOTX Metadata Extraction in Java

GroupDocs.Metadata makes it easy for Java developers to get metadata information from DOTX files from within their applications by implementing a few easy steps.

  • Load the DOTX file to be updated.
  • Specify a predicate that will be used to filter desired metadata properties.
  • Specify a value which you want to be assigned to the selected properties.
  • Pass the predicate and the new value to the UpdateProperties method.
  • Check the actual number of updated properties.
  • Save the changes.

System Requirements

GroupDocs.Metadata for Java APIs are supported on all major platforms and operating systems. Before executing the code below, please make sure that you have the following prerequisites installled on your system.

  • Operating Systems: Microsoft Windows, Linux, MacOS
  • Development Environment: NetBeans, Intellij IDEA, Eclipse etc
  • Java Runtime Environment: J2SE 6.0 and above
  • Get the latest version of GroupDocs.Metadata for Java from Maven

public class UpdatingMetadata {
    public static void run() {
        Date threeDaysAgo = new Date(System.currentTimeMillis() - TimeUnit.DAYS.toMillis(3));
        try (Metadata metadata = new Metadata("input.dotx")) {
                // Update the file creation date/time if the existing value is older than 3 days
                int affected = metadata.updateProperties(new ContainsTagSpecification(Tags.getTime().getCreated()).and(
                        new OfTypeSpecification(MetadataPropertyType.DateTime)).and(
                        new UpdatingMetadata().new DateBeforeSpecification(threeDaysAgo)), new PropertyValue(new Date()));

                System.out.println(String.format("Affected properties: %s", affected));

                metadata.save("output.dotx");
        }
    }

    // Define your own specifications to filter metadata properties
    public class DateBeforeSpecification extends Specification {
        public DateBeforeSpecification(Date date) {
            setValue(date);
        }

        public final Date getValue() {
            return auto_Value;
        }

        private void setValue(Date value) {
            auto_Value = value;
        }

        private Date auto_Value;

        public boolean isSatisfiedBy(MetadataProperty candidate) {
            Date date = candidate.getValue().toClass(Date.class);
            if (date != null) {
                return date.before(getValue());
            }
            return false;
        }
    }
}

Live Demos of Editing Metadata

Update metadata information of DOTX file right now by visiting GroupDocs.Metadata Live Demos website.
The live demo has the following benefits

No need to download GroupDocs API.

No need to write any code

Just upload the source file to have an instant display.

Get the download link to save the file on your machine.

About DOTX File Format

Files with DOTX extension are template files created by Microsoft Word to have pre-formatted settings for generation of further DOCX files. A template file is created in order to have specific user settings that should be applied to subsequent flies created from these. These settings include page margins, borders, headers, footers, and other page settings. Such templates are used in official documents such as company letterheads and standardized forms. The DOTX file format was introduced with the release of Microsoft Office 2007 to replace the binary DOT file format, but is supported by higher versions as well. Microsoft Word by default opens every new document based on normal.dot file. If modified, all the new files created will result in same settings as from the template file. In Microsoft Word 2007, the DOT file format has been replaced with Office OpenXML based DOTX file format.

Read More

Changing Metadata Of Other File Formats

Multi format documents and images metadata editing API for Java. Get metadata details of some of the popular file formats as stated below.

Update PDF Metadata

(Adobe Portable Document Format)

Update DOC Metadata

(Microsoft Word Document)

Update DOCM Metadata

(Microsoft Word Macro-Enabled Document)

Update DOCX Metadata

(Microsoft Word Open XML Document)

Update DOT Metadata

(Microsoft Word Document Template)

Update DOTX Metadata

(Word Open XML Document Template)

Update XLS Metadata

(Microsoft Excel Binary File Format)

Update XLSX Metadata

(Microsoft Excel Open XML Spreadsheet)

Update XLSM Metadata

(Microsoft Excel Macro-Enabled Spreadsheet)

Update XLTM Metadata

(OOXML Macro Enabled Workbook Template)

Update PPT Metadata

(PowerPoint Presentation)

Update PPS Metadata

(Microsoft PowerPoint Slide Show)

Update PPTX Metadata

(PowerPoint Open XML Presentation)

Update PPSX Metadata

(PowerPoint Open XML Slide Show)

Update POTX Metadata

(Microsoft PowerPoint Open XML Template)

Update POTM Metadata

(Microsoft PowerPoint Template)

Update PPTM Metadata

(Microsoft PowerPoint Presentation)

Update PPSM Metadata

(Microsoft PowerPoint Slide Show)

Update ODS Metadata

(Open Document Spreadsheet)

Update ODT Metadata

(Open Document Text)

Update TIFF Metadata

(Tagged Image File Format)

Update PNG Metadata

(Portable Network Graphic)

Update GIF Metadata

(Graphical Interchange Format File)

Update BMP Metadata

(Bitmap File Format)

Update JP2 Metadata

(JPEG 2000 Core Image File)

Update WEBP Metadata

(Raster Web Image File Format)

Update PSD Metadata

(Adobe Photoshop Document)

Update WMF Metadata

(Windows Metafile)

Update EMF Metadata

(Enhanced Metafile Format)

Update MPP Metadata

(Microsoft Project Document)

Update MSG Metadata

(Microsoft Outlook E-mail Message)

Update EML Metadata

(E-mail Message)

Update DWG Metadata

(Autodesk Design Data Formats)

Update DXF Metadata

(AutoCAD Drawing Interchange)

Update ONE Metadata

(Microsoft OneNote)

Update MP3 Metadata

(MPEG Audio Layer III)

Update WAV Metadata

(Waveform Audio File Format)

Update DICOM Metadata

(Digital Imaging & Comm in Medicine)

Update AVI Metadata

(Audio Video Interleave File)

Update VSD Metadata

(Microsoft Visio 2003-2010 Drawing)

Update VSDX Metadata

(Microsoft Visio Drawing)

Update VSS Metadata

(Microsoft Visio 2003-2010 Stencil)

Update VDX Metadata

(Microsoft Visio 2003-2010 XML Drawing)

Update VSX Metadata

(Microsoft Visio 2003-2010 XML Stencil)

Update ZIP Metadata

(Archive File Format)

Update EPUB Metadata

(Digital E-Book File Format)

Update VCF Metadata

(Electronic Business Card)