1

ファイルからテキストを抽出するために IFilter COM Object を使用しています。OLE プロパティの(作成者の値、会社の値など) を抽出することはできましたが、どの値が作成者、会社などであるかを知る方法がわかりませんでした..

CoInitialize(NULL);
IFilter *pFilt;
HRESULT hr = LoadIFilter( L"c:\\bla.docx", 0, (void**)&pFilt );
if ( FAILED( hr ) )
{
    cout<<"Bla"<<endl;
}

ULONG flags;
hr = pFilt->Init( IFILTER_INIT_APPLY_INDEX_ATTRIBUTES, 0, 0, &flags );
if ( FAILED( hr ) )
{
    cout<<"Bla"<<endl;
}
if(flags == 1)
{
    cout<<"With OLE!"<<endl;
}
STAT_CHUNK chunk;
while ( SUCCEEDED( hr = pFilt->GetChunk( &chunk ) ) )
{
    if ( CHUNK_TEXT == chunk.flags )
    {
        WCHAR awc[100];
        ULONG cwc = 100;
        while ( SUCCEEDED( hr = pFilt->GetText( &cwc, awc ) ) )
        {
            cout<<awc<<endl;
            // process the text buffer.&nbsp;.&nbsp;.
        }
    }
    else // CHUNK_VALUE
    {
        PROPVARIANT *pVar;
        while ( SUCCEEDED( hr = pFilt->GetValue( &pVar ) ) )
        {

            **// Right here, i can see the value of pVar is the correct author, but i dont know how to tell this is the author, or the company etc..**
            PropVariantClear( pVar );
            CoTaskMemFree( pVar );
        }
    }

}

つまり、プロパティ ID を把握し、それをプロパティの値と一致させる必要があります。

IPropertyStorage->ReadMultiple を使用したソリューションを見てきましたが、IFilter を使用して同じものを取得しようとしています。

どうもありがとう!答えが見つかることを願っています。

4

1 に答える 1