openoffice

gasomma

Member
hi there,
i would like to create OpenOffice calc and writer documents with a progress application. I still use 9.1d in windows env. Can anybody give me some suggestion for find examples or other else?

thanks in advance.
JCA
 

StoneKeeper

New Member
hi,
this code example works for openedge 10.1c - opens a calc sheet and writes some text into a cell. I do not know if it will work with 9.1d. Here i am using OOo 3.2. Regards


DO:

DEFINE VARIABLE oService AS COM-HANDLE no-undo.
DEFINE VARIABLE oDesktop AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE oSheet AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE oSheets AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE oCellRange AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE oDocument AS COM-HANDLE no-undo.
DEFINE VARIABLE Args AS RAW NO-UNDO.

CREATE "com.sun.star.ServiceManager" oService.
oDesktop=oService:createinstance("com.sun.star.frame.Desktop").
oDocument=oDesktop:loadComponentFromURL("private:factory/scalc","_blank",0,Args).

oSheets = oDocument:getSheets().
oSheet = oSheets:GetByIndex(0).
oCellRange = oSheet:Getcellrangebyname("a1").
oCellRange:STRING="OpenOffice!".

RELEASE OBJECT oCellRange.
RELEASE OBJECT oSheet.
RELEASE OBJECT oSheets.
RELEASE OBJECT oDocument.
RELEASE OBJECT oDesktop.
release object oService.
MESSAGE "Done!" VIEW-AS ALERT-BOX.
END.
 
Top