Hi Tim,

the OLE automation bridge is your friend from Delphi.

Juergen

Tim Lebedkov (UPK) wrote:
Hello,

as nobody answered to my question, I would at least like to know:

-          who is responsible for the ActiveX API?

- if ActiveX is not a supported API, which one should I use from Delphi?

Regards

Tim Lebedkov

Unternehmensberatung Peter Kloß GmbH
Robert-Bosch-Str. 14
30989 Gehrden

Tel: +49 5108 9126 22
Fax: +49 5108 9126 29
E-Mail: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
Internet: http://www.upk.de <http://www.upk.de/>
Geschäftsführung: Peter Kloß
Registergericht Hannover HRB 102304

Sie haben die Daten, wir haben Ihren Katalog!
UPK KatXPress ist da - mehr Informationen erhalten Sie unter http://www.upk.de/produkte/katxpress.pdf

------------------------------------------------------------------------

*Von:* Tim Lebedkov (UPK)
*Gesendet:* Mittwoch, 5. März 2008 16:30
*An:* '[EMAIL PROTECTED]'
*Betreff:* LinguServiceManager through OLE

Hello,

I try to use the LinguServiceManager through OLE.

The following Delphi code fails at the marked line with:

[automation bridge] unexpected exception in

UnoConversionUtilities<T>::variantToAny !

==============================================================================================

function TSampleCode.Hyphenate(S: string): string;

var

    H: Variant;

    Locale: Variant;

    Props: Variant;

    HW: Variant;

    CoreReflection: Variant;

    LSM: Variant;

begin

    LSM := StarOffice.createInstance(

            'com.sun.star.linguistic2.LinguServiceManager');

    if VarIsArray(LSM) then

        Exit;

    if (VarIsEmpty(LSM) or VarIsNull(LSM)) then

        Exit;

    CoreReflection := StarOffice.createInstance(

            'com.sun.star.reflection.CoreReflection');

    CoreReflection.forName('com.sun.star.lang.Locale').createObject(

            Locale);

    Locale.Language := 'de';

    Locale.Country := '';

    Locale.Variant := '';

    H := LSM.getHyphenator(); // <=============== here an error

    HW := H.hyphenate('Silbentrennung', Locale, 2, Props);

    H := Null;

    Props := Null;

    Locale := Null;

    LSM := Null;

end;

==============================================================================================

I tried to program the same in Visual Basic Script but it doesn’t work either:

The following Visual Basic Script code does not work either (it shows 
"Nothing"):

==============================================================================================

Set StarOffice = WScript.CreateObject("com.sun.star.ServiceManager")

Set LSM = 
StarOffice.createInstance("com.sun.star.linguistic2.LinguServiceManager")

Set CoreReflection =

StarOffice.createInstance("com.sun.star.reflection.CoreReflection")

Dim Locale

Set Cl = CoreReflection.forName("com.sun.star.lang.Locale")

Cl.createObject Locale

Locale.Language = "de"

Locale.Country = "DE"

Locale.Variant = ""

Dim PV

Set Cl = CoreReflection.forName("com.sun.star.beans.PropertyValue")
Cl.createObject PV

Set H = LSM.getHyphenator()

Dim Props(0)

Set Props(0) = PV

Set xHW = H.hyphenate("Silbentrennung", Locale, 0, Props)

MsgBox TypeName(xHW)

==============================================================================================

Does anybody know what I am doing wrong here?

Thanks in advance

--Tim



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to