Autor eines Word/Excel-Dokumentes über OLE auslesen
-
Hallo,
ich habe einen OLEContainer der ein Word- oder ein Excel-Dokument beinhaltet.
Ich greife auf einige Eigenschaften über OLEContiner1->OleObject.OlePropertyGet(...). Meine Frage nun: Wie kann ich auf den Names des Autors eines Dokumentes zugreifen?
Ich habe gegooglet und nur was mit "BuiltinDocumentProperties" und VB-Script gefunden. Wie mache ich das aber in C++?
Gruß
Hawk
-
Mittlerweile habe ich etwas gefunden. Für WORD funktioniert es, aber nicht für Excel.
Wie geht es für Excel?
Variant oledoc; Variant doc; Variant builtInProp; String docauthor; //-----Autor anzeigen if (OLEContainer1->OleClassName.Pos("Word")>0) /// Ist Word Dokument { oledoc= OLE->OleObject.OlePropertyGet("Application"); doc = oledoc.OlePropertyGet("ActiveDocument") ; } if (OLEContainer1->OleClassName.Pos("Excel")>0) // Ist Excel Dokument { oledoc= OLE->OleObject.OlePropertyGet("Workbooks"); //??? doc = oledoc.OlePropertyGet("ActiveWorkbook") ; ///????? } builtInProp = doc.OlePropertyGet("BuiltInDocumentProperties"); PropertyGet Item("Item") ; Item.ClearArgs() ; docauthor = builtInProp.Exec(Item << (Variant)3); //-- 3 ist Index für Autor ShowMessage(docauthor);