alex_smith
asked on
Using Delphi to automate LibreOffice?
I wrote a program in Delphi XE2 that opens an OpenOffice spreadsheet, inserts some data, formats it & then prints it. It worked fine, albeit slowly.
I've just uninstalled OpenOffice (3.3) & installed LibreOffice (4.1.3.2). Now I get an error message:
Invalid class string progid com.sun.star.ServiceManage r
I've tracked it down to the 6th line of this procedure:
unit OOoTools;
{
This unit is part of a toolbox to pilot OpenOffice.org from Delphi using COM Automation.
Copyright (C) 2004-2007 Bernard Marcelly
This unit is free software; you can redistribute it and/or modify it under the terms of
the GNU Lesser General Public License as published by the Free Software Foundation;
either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this
library; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
}
I've just uninstalled OpenOffice (3.3) & installed LibreOffice (4.1.3.2). Now I get an error message:
Invalid class string progid com.sun.star.ServiceManage
I've tracked it down to the 6th line of this procedure:
procedure ConnectOpenOffice;
begin
if IsOpenOfficeConnected then exit;
Screen.Cursor:= crHourglass; Application.ProcessMessages;
try
OpenOffice:= CreateOleObject('com.sun.star.ServiceManager'); // <---- This line
if isNullEmpty(OpenOffice) then Raise EOOoError.Create(OOo_connectKO);
StarDesktop:= CreateUnoService('com.sun.star.frame.Desktop');
disp:= CreateUnoService('com.sun.star.frame.DispatchHelper');
OOoIntrospection:= CreateUnoService('com.sun.star.beans.Introspection');
OOoReflection:= CreateUnoService('com.sun.star.reflection.CoreReflection');
finally
Screen.Cursor:= crDefault;
end;
end;
Not sure what to do next, as the above code is in this file:unit OOoTools;
{
This unit is part of a toolbox to pilot OpenOffice.org from Delphi using COM Automation.
Copyright (C) 2004-2007 Bernard Marcelly
This unit is free software; you can redistribute it and/or modify it under the terms of
the GNU Lesser General Public License as published by the Free Software Foundation;
either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this
library; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.