Hi

I use OpenOffice with Visual FoxPro for merging data with documents so I have included samples of my code which should be easily translated to xBase+

Simon


<pre>
PROCEDURE merge
   With This
      Do Case
      Case .cMergeType="OO"
         Local loFind
         loFind=.oMergeDoc.createReplaceDescriptor()
         For ln=1 To ALen(.aMerge,1)
             lcMerge=.aMerge(ln,2)
             lcMerge=Iif(lcMerge="=",Evaluate(Right(lcMerge,Len(lcMerge)-1)),lcMerge)
             loFind.ReplaceString=lcMerge
             loFind.SearchString=.aMerge(ln,1)
             .oMergeDoc.ReplaceAll(loFind)
         EndFor
         loFind=""
         Release loFind,ln
      Case .cMergeType="OOC"
      EndCase
   EndWith
ENDPROC
*-- The cleanup method after merging
PROCEDURE mergecleanup
   Lparameters tlVisible
   If Vartype(goApp.oPrintParam)="O"
      tlVisible=goApp.oPrintParam.PrintOptions=DC_VIEW
      goApp.oPrintParam.PrintOptions=-1
   EndIf
   With This
   Do Case

   Case .cMergeType="OO"                
      If
VarType(.oMergeDoc)="O"    
         .oMergeDoc.getCurrentController().getFrame().getContainerWindow().setVisible(tlVisible)
      EndIf       
      .oMergeDoc=""  
      .oMergeSrvMgr=""
      =!tlVisible.And..oMerge.Terminate()
   EndCase
ENDPROC
*-- Opens the merge document for merging
PROCEDURE mergeopendoc
   Lparameters tcFile
   With This
      .cMergeFile=tcFile
      Do Case
      Case .cMergeType="OO".And.File(tcFile)
         Local loProp,loRefl,laArgs(2),laPrt(1)
         loRefl=.oMergeSrvMgr.createInstance("com.sun.star.reflection.CoreReflection")
         loProp=CreateObject("Empty")    && Creates an empty object that will become an OO property object.
         loRefl.forName("com.sun.star.beans.PropertyValue").createobject(@loProp)
         laArgs(1)=loProp
         laArgs(1).Name="ReadOnly"
         laArgs(1).Value=.N.
         laArgs(2)=loProp
         laArgs(2).Name="Hidden"
         laArgs(2).Value=.T.
         ComArray(.oMerge,10)  && convert VFP arrays to COM compatible array
         .oMergeDoc=.oMerge.loadComponentFromURL(ConvertToURL(tcFile),"_blank",0,@laArgs)
         If VarType(goApp.oPrintParam)="O"  && load printer if printer dialog displayed
            loProp=CreateObject("Empty")
            loRefl.forName("com.sun.star.beans.PropertyValue").createobject(@loProp)
            laPrt(1)=loProp
            laPrt(1).Name="Name"
            laPrt(1).Value=AllTrim(goApp.oPrintParam.Printer)
            ComArray(.oMergeDoc,10)
            .oMergeDoc.SetPrinter(@laPrt)
         EndIf
         Store "" to loRefl,loProp
      EndCase
   EndWith
ENDPROC
*-- Prints the merged document
PROCEDURE mergeprint
   With This
      Do Case
       Case .cMergeType="OO"
          Local loProp,loRefl,laArgs(3)
          loRefl=.oMergeSrvMgr.createInstance("com.sun.star.reflection.CoreReflection")
          loProp=CreateObject("Empty")
          loRefl.forName("com.sun.star.beans.PropertyValue").createobject(@loProp)
          laArgs(1)=loProp
          laArgs(1).Name="CopyCount"
          laArgs(1).Value=goApp.oPrintParam.Copies
          laArgs(2)=loProp
          laArgs(2).Name="Pages"
          laArgs(2).Value=Transform(goApp.oPrintParam.StartPage)+"-"+Transform(goApp.oPrintParam.LastPage)
          laArgs(3)=loProp
          laArgs(3).Name="Wait"
          laArgs(3).Value=.T.
          ComArray(.oMergeDoc,10)
          .oMergeDoc.Print(@laArgs)
          .MergeClose()
       EndCase
    EndWith
ENDPROC
*-- Sets up the merge variables.
PROCEDURE mergesetup
   LParameter tcType
   With This
      .cMergeType=tcType
      .cMergedFile=gcTmp+Sys(2015)+".rtf"
      Do Case
      Case .cMergeType="OO"
         .oMergeSrvMgr=CreateObject("com.sun.star.ServiceManager")
         .oMerge=.oMergeSrvMgr.createInstance("com.sun.star.frame.Desktop")
      EndCase
   EndWith
ENDPROC
PROCEDURE mergesave
   Lparameters tcFile
   With This
      Do Case
      Case .cMergeType="OO"
         Local loProp,loRefl,laArgs(2)
         loRefl=.oMergeSrvMgr.createInstance("com.sun.star.reflection.CoreReflection")
         loProp=CreateObject("Empty")
         loRefl.forName("com.sun.star.beans.PropertyValue").createobject(@loProp)
         laArgs(1)=loProp
         laArgs(1).Name="Overwrite"
         laArgs(1).value=.T.
         ComArray(.oMerge,10)
         .oMergeDoc.StoreAsURL(ConvertToURL(tcFile),@laArgs)
      EndCase
           
   EndWith  
ENDPROC
*-- Close the active document
PROCEDURE mergeclose
    With This
       Do Case
       Case .cMergeType="OO"
          .oMergeDoc.setModified(.F.)
          .oMergeDoc.Close(.T.)
          .oMergeDoc=""
       EndCase
    EndWith
EndProc
</pre>




On 21/06/2010 12:44 PM, Richard Matthews wrote:
> Hi everyone,
>
> Using the OpenOffice does anyone have any examples of the document writing
> etc.
>
>   oOffice := CreateObject( 'Com.Sun.Star.ServiceManager')
>   oOffice :=oOffice:dynamicCast( ActiveXObject() )
>
> I can't get my oWord equivalent to work with the openoffice.
>
> -
>
>
> Best regards
>
> Richard
>
> Richard Matthews
> Smart Warehouse Systems Ltd
>
>
>
>


On 21/06/2010 12:44 PM, Richard Matthews wrote:
Hi everyone,

Using the OpenOffice does anyone have any examples of the document
writing 
etc.

 oOffice := CreateObject( 'Com.Sun.Star.ServiceManager')
 oOffice :=oOffice:dynamicCast( ActiveXObject() )

I can't get my oWord equivalent to work with the openoffice.

-


Best regards

Richard

Richard Matthews
Smart Warehouse Systems Ltd