5,139
社区成员
发帖
与我相关
我的任务
分享
IDispatch *pCPDisp;
DocumentPropertiesPtr pDocProps;
DocumentPropertyPtr pDocProp;
VARIANT vDocPropIndex;
vDocPropIndex.vt = VT_I4;
hr = spDoc->get_CustomDocumentProperties(&pCPDisp);
if(SUCCEEDED(hr))
{
hr = pCPDisp->QueryInterface(IID_DocumentProperties, (void **)&pDocProps);
if(SUCCEEDED(hr))
{
long lPropCnt = pDocProps->GetCount();
for(int i = 0; i <= lPropCnt; i ++) //自定义属性index从1开始
{
vDocPropIndex.lVal = i;
pDocProps->get_Item(vDocPropIndex, 0, &pDocProp);
if(pDocProp)
{
pDocProp->get_Name(0, &bstrPropValue);
pDocProp->get_Value(0, &vargRetValue);
pDocProp->Release();
}
}
pDocProps->Release();
}
pCPDisp->Release();
}