本文介绍了以编程方式修改文件属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要以编程方式修改文件的属性,尤其是在右键单击文件时在摘要"选项卡下的详细信息:标题,主题,作者,类别,注释.
有人知道如何在C ++或C#中执行此操作吗?

I need to modify a file''s properties programmatically, specifically the details under the ''Summary'' tab when you right click on a file: Title, Subject, Author, Category, Comments.
Anybody know how to do this in C++ or C#?

推荐答案

private void ChangeProp(string file, string author)
{
  DSOFile.OleDocumentPropertiesClass documentProperties = new DSOFile.OleDocumentPropertiesClass();
  DSOFile.SummaryProperties summaryProperties;

  try
  {
    documentProperties.Open(file, false, DSOFile.dsoFileOpenOptions.dsoOptionDefault);

    summaryProperties = documentProperties.SummaryProperties;
    summaryProperties.Author = author;
    documentProperties.Save();
  }
  finally
  {
    summaryProperties = null;
    documentProperties = null;
  }
}



这篇关于以编程方式修改文件属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 14:34