Ein freundliches Hallo an alle,
hab' mal wieder ein OpenOffice-Problem. Ich möchte auf ein Textdokument zugreifen und dort Daten bei Bookmarks eintragen.
In Basic bei OO sieht das so aus:
Quelltext
1: 2: 3:
| doc = ThisComponent BookMark = doc.getBookmarks().getByName("Abs_Nam") BookMark.getAnchor.setString("Test") |
In Delphi 4:
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11:
| OpenOffice := CreateOleObject('com.sun.star.ServiceManager'); StarDesktop := OpenOffice.createInstance('com.sun.star.frame.Desktop'); disp := OpenOffice.createInstance('com.sun.star.frame.DispatchHelper'); OOoIntrospection := OpenOffice.createInstance('com.sun.star.beans.Introspection'); OOoReflection := OpenOffice.createInstance('com.sun.star.reflection.CoreReflection'); sv := OpenOffice.createInstance('com.sun.star.ucb.FileContentProvider');
Path := sv.getFileURLFromSystemPath('', Path); Doc := StarDesktop.loadComponentFromURL( Path, '_blank', 0, VarArrayCreate([0, - 1], varVariant) ); BookMark := Doc.getBookmarks(); BookMark := Doc.getBookmarks().getByName('Abs_Nam'); |
Schon in der Testzeile "BookMark := Doc.getBookmarks();" kommt eine Fehlermeldung: "UnoConversionUtilities<T>::variantToAny" (Siehe auch Bild). Hoffe jemand weiß was das bedeutet und wie es zu beheben ist.
Danke euch im Voraus und grüße von der Nordsee
Peter