Page 1 of 1

[Solved] Deplhi - Could not convert variant of type...

PostPosted: Thu Sep 22, 2016 12:54 pm
by Sk1X1
Hello guys,
I'm trying to open LibreOffice from Delphi script. I read some articles and wrote this code:

Code: Select all   Expand viewCollapse view
var
  FOffice, FDesktop, FDocument: Variant;
begin
  FOffice := CreateOleObject('com.sun.star.ServiceManager');
  FDesktop := FOffice.CreateInstance('com.sun.star.frame.Dekstop');
  OpenParams := VarArrayCreate([0, 0], varVariant);
  FDocument := FDesktop.LoadComponentFromURL('private:factory/swriter', '_default', 0, OpenParams);
end;


But when I try to run it, on the last line I get this error:
Code: Select all   Expand viewCollapse view
Could not convert variant of type (Unknown) into type (Integer)


What am I doing wrong?
Thanks for all replies.

Re: Deplhi - Could not convert variant of type...

PostPosted: Thu Sep 22, 2016 4:33 pm
by Zizi64
'com.sun.star.frame.Dekstop'

Re: Deplhi - Could not convert variant of type...

PostPosted: Fri Sep 23, 2016 8:32 am
by Sk1X1
Oh, I was looking into this code so long that I overlooked this :(
Thanks a lot!

Re: Deplhi - Could not convert variant of type...

PostPosted: Fri Sep 23, 2016 9:13 am
by robleyd
You might find this site or this other site handy for code reviews :lol: