Hi
I am trying to automate the insertion of an image into a spreadsheet using the following code. However the image is not inserted so I am wondering where I have made a mistake. In addition I would like to insert 5 new rows into the top of the spreadsheet so that not data appears behind the image. Everything works fine if I use the LibreOffice application but not when I try to automate the procedure.
Thanks,
Simon
lo=CreateObject("cusBizobj")
lo.oMergeSrvMgr=CreateObject("com.sun.star.ServiceManager")
lo.oMerge=lo.oMergeSrvMgr.createInstance("com.sun.star.frame.Desktop")
Dimension laArgs(2)
laArgs(1)=lo.oMergeSrvMgr.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
laArgs(1).Name="ReadOnly"
laArgs(1).Value=.N.
laArgs(2)=lo.oMergeSrvMgr.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
laArgs(2).Name="Hidden"
laArgs(2).Value=.T.
ComArray(lo.oMerge,10) && convert VFP arrays to COM compatible array
lo.oMergeDoc=lo.oMerge.loadComponentFromURL(ConvertToURL("D:\KardTech\Exp\Leder.xls"),"_blank",0,@laArgs)
loSheet=lo.oMergeDoc.getSheets().getByIndex(0)
loPage=loSheet.DrawPage()
loImg=lo.oMergeDoc.createInstance("com.sun.star.drawing.GraphicObjectShape")
loImg.GraphicURL = convertToURL("D:\KardTech\Img\Logo.png")
loPos = lo.oMergeSrvMgr.Bridge_GetStruct("com.sun.star.awt.Point")
loPos.X = 0
loPos.Y = 0
loSize = lo.oMergeSrvMgr.Bridge_GetStruct("com.sun.star.awt.Size")
loSize.Width = 150
loSize.Height = 103
loImg.Position=loPos
loImg.Size=loSize
loImg.Name="Logo"
loPage.Add(loImg)
Dimension laArgs(1)
lo.oMergeDoc.getCurrentController().getFrame().getContainerWindow().setVisible(.T.) && View SpreadSheet
laArgs(1)=lo.oMergeSrvMgr.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
laArgs(1).Name="FilterName"
laArgs(1).Value="MS Excel 97"
ComArray(lo.oMergeDoc,10)
lo.oMergeDoc.storeToURL(ConvertToURL("D:\KardTech\Exp\New.xls"),@laArgs)
lo.oMergeDoc.close(1)
lo.oMerge.Terminate()