asp.net读写文件属性,如标题,主题,作者等

时间:2008-11-14    点击:2361   

我用的是vs2005,c#做的

读文件属性代码: 添加引用,microsoft shell controls and automation

using Shell32;


string sFileType = ""; //2
string sFileAuthor = ""; //9
string sFileTitle = ""; //10
string sFileSubject = ""; //11
string sFileCategory = ""; //12
string sFileComment = ""; //14


ShellClass sh = new ShellClass();
Folder dir1 = sh.NameSpace(Path.GetDirectoryName(filepath));
FolderItem item = dir1.ParseName(Path.GetFileName(filepath));

sFileType = dir1.GetDetailsOf(item, 2);
sFileAuthor = dir1.GetDetailsOf(item, 9);
sFileTitle = dir1.GetDetailsOf(item, 10);
sFileSubject = dir1.GetDetailsOf(item, 11);
sFileCategory = dir1.GetDetailsOf(item, 12);
sFileComment = dir1.GetDetailsOf(item, 14);

 


写文件属性

1. 下载dsofile.dll,你也可以在微软网站上搜索下载,放入system32文件夹下,开始菜单,运行,输入cmd 进入到system32目录下 输入regsvr32 dsofile.dll,注册组建,然后添加引用



DSOFile.OleDocumentProperties dso = new DSOFile.OleDocumentProperties();
dso.Open(path, false, DSOFile.dsoFileOpenOptions.dsoOptionUseMBCStringsForNewSets);

dso.SummaryProperties.Title = "";
dso.SummaryProperties.Subject = "";
dso.SummaryProperties.Author = "";
dso.SummaryProperties.Comments = "";

dso.Save();
dso.Close(false);

背景不停变换颜色
随机的背景图案
下拉列表直接选择背景
礼花背景
背景斜向移动
> 返回     
地址:上海市普陀区胶州路941号长久商务中心 电话: QQ:
© Copyright 2012 上海网络 All Rights Reserved