怎么获取word、excel文件属性
c++ builder中怎么获取word、excel文件属性中的“摘要→原始→应用程序名”?
[解决办法]
OLE专业户来也!!!
BTW: OLE专业户好久不见的说。- -#
String strDocName = "C:\\ccrun\\123.doc ";
Variant vWordApp;
try
{
vWordApp = Variant::CreateObject( "Word.Application ");
}
catch(...)
{
MessageBox(Handle, "启动Word出错! ",
Application-> Title.c_str(), MB_OK | MB_ICONERROR);
vWordApp = Unassigned;
return;
}
Variant vDoc = vWordApp.OlePropertyGet( "Documents ").
OleFunction( "Open ", strDocName.c_str());
// 获取文件属性--》原始--》应用程序名
String strPropertyAppName = vDoc.OlePropertyGet(
"BuiltInDocumentProperties ", 9); // wdPropertyAppName
ShowMessage(strPropertyAppName);
// 获取文件属性--》原始--》作者
String strPropertyAuthor = vDoc.OlePropertyGet(
"BuiltInDocumentProperties ", 3); // wdPropertyAuthor
ShowMessage(strPropertyAuthor);
//
vDoc.OleProcedure( "Close ");
Application-> ProcessMessages();
vWordApp.OleProcedure( "Quit ");
Application-> ProcessMessages();
vDoc = Unassigned;
vWordApp = Unassigned;