控件本身没有直接设置创建人等属性的功能,你可以使用微软的 DSOFile 来实现(http://support.microsoft.com/kb/224351/):
- private void SetProperties(DocumentProperties docProp)
- {
- DSOFile.OleDocumentProperties m_oDocument = new DSOFile.OleDocumentPropertiesClass();
- m_oDocument.Open(txtFilename.Text, false, DSOFile.dsoFileOpenOptions.dsoOptionOpenReadOnlyIfNoWriteAccess);
- m_oDocument.SummaryProperties.Title = docProp.Title;
- m_oDocument.SummaryProperties.Author = docProp.Author;
- m_oDocument.SummaryProperties.Comments = docProp.Comments;
- m_oDocument.SummaryProperties.Company = docProp.Company;
- m_oDocument.SummaryProperties.Subject = docProp.Subject;
- m_oDocument.Save();
- m_oDocument.Close(true);
- }
- public struct DocumentProperties
- {
- public string Title;
- public string Author;
- public string Comments;
- public string Company
- public string Subject;
- }
复制代码 |