v25.4.1
What's Changed
- Support for modifications to word document metadata by @sabir-aspose in #16
Full Changelog: v25.4.0...v25.4.1
Usage Code Example
var document = new Openize.Words.Document("word.docx");
var oldProps = document.GetDocumentProperties();
var props = new Openize.Words.DocumentProperties();
// Helper to print and update
void UpdateProperty<T>(string name, T oldValue, T newValue, Action<T> setValue)
{
Console.WriteLine($"Old {name} : {oldValue}");
setValue(newValue);
Console.WriteLine($"New {name} : {newValue}");
}
// Update metadata
UpdateProperty("Title", oldProps.Title, "Updated Title", val => props.Title = val);
UpdateProperty("Subject", oldProps.Subject, "Updated Subject", val => props.Subject = val);
UpdateProperty("Description", oldProps.Description, "Updated Description", val => props.Description = val);
UpdateProperty("Creator", oldProps.Creator, "Updated Creator", val => props.Creator = val);
UpdateProperty("Keywords", oldProps.Keywords, "Updated.Keyword", val => props.Keywords = val);
UpdateProperty("LastModifiedBy", oldProps.LastModifiedBy, "Updated.Openize.OpenXML-SDK", val => props.LastModifiedBy = val);
UpdateProperty("Revision", oldProps.Revision, "Version.Revised", val => props.Revision = val);
UpdateProperty("Created", oldProps.Created, oldProps.Created, val => props.Created = val);
var currentTime = DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ");
UpdateProperty("Modified", oldProps.Modified, currentTime, val => props.Modified = val);
document.SetDocumentProperties(props);
document.Save("word2.docx");