Retrieve application property values from a word processing document
Application properties are stored in the extended file properties part, usually docProps/app.xml.
These are package-level extended properties, not content in the main document part. They can describe application name, page count, word count, template, company, presentation format, and other producer-maintained metadata.
Read application properties
#![allow(unused)] fn main() { pub fn get_application_properties( path: &Path, ) -> Result<Vec<(String, String)>, Box<dyn std::error::Error>> { let document = WordprocessingDocument::new_from_file_with_settings(path, lazy_settings())?; let Some(app_part) = document.extended_file_properties_part() else { return Ok(Vec::new()); }; let xml = app_part.data_as_str(&document)?.unwrap_or_default(); Ok(extract_known_app_properties(xml)) } }
The example reads a few common extended properties from the package-level part.
Extended properties markup
<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties">
<Application>ooxmlsdk-doc</Application>
<Pages>1</Pages>
<Words>4</Words>
</Properties>
Not every document contains every property. Treat this part as optional.
Unlike core properties, individual extended properties can be absent when the producing application did not set them. Check the part and each requested element before reading text.
In ooxmlsdk, WordprocessingDocument::extended_file_properties_part() locates the part when present.