function CheckSchemaFileExistence(){
var
Schemafilename=document.getElementById('<%= this.flUploadB.ClientID %>').value;if(Schemafilename.length>0){
return true;}
else
{
alert(
"File Name cannot be empty");return false;}
}
we written code in button click . i need a file author name . how to find it can any tell me .
thanks in advance
![]() |
0 |
![]() |
Hi harish448
For your information, I know you want to get the file's author name, which from client-side
But I think Not all type of files have the attribute of "author name" (I think only office file like .doc .xls have)
if you want to get a .doc file's author name, I suggest you to use OWC
The following code show how to get a doc file's author name and subject, Hope this helps:
Word.Application oWord;
Word._Document oDoc;
object oMissing = Missing.Value;
object docBuiltInProps;
object Source = @"DocPath";
object Unknown =Type.Missing;
oWord = new Word.Application();
![]()
try
{
oDoc = oWord.Documents.Open(ref Source,ref Unknown,
ref Unknown,ref Unknown,ref Unknown,
ref Unknown,ref Unknown,ref Unknown,
ref Unknown,ref Unknown,ref Unknown,
ref Unknown );
docBuiltInProps = oDoc.BuiltInDocumentProperties;
Type typeDocBuiltInProps = docBuiltInProps.GetType();
//è·åä½è
string index = "Author";
string propsValue;
object docAuthor = typeDocBuiltInProps.InvokeMember("Item",
BindingFlags.Default |
BindingFlags.GetProperty,
null,docBuiltInProps,
new object[] {index} );
Type typeDocAuthorProp = docAuthor.GetType();
propsValue = typeDocAuthorProp.InvokeMember("Value",
BindingFlags.Default |
BindingFlags.GetProperty,
null,docAuthor,
new object[] {} ).ToString();
MessageBox.Show( propsValue,"Author" );
//è·å主é¢
index = "Subject";
propsValue = "The Subject";
object docSubjectProp = typeDocBuiltInProps.InvokeMember("Item",
BindingFlags.Default |
BindingFlags.GetProperty,
null,docBuiltInProps,
new object[] {index} );
Type typeDocSubjectProp = docSubjectProp.GetType();
propsValue = typeDocSubjectProp.InvokeMember("Value",
BindingFlags.Default |BindingFlags.GetProperty,
null,docSubjectProp,
new object[] {} ).ToString();
MessageBox.Show( propsValue,"Subject" );
}finally
{
//å ³éwordè¿ç¨
object save = false;
oWord.Quit(ref save,ref Unknown,ref Unknown);
System.Runtime.InteropServices.Marshal.ReleaseComObject(oWord);
}
Regards!
-- "Mark As Answer" If my reply helped you --
![]() |
0 |
![]() |