Code: Select all
...
'Opening Calc
oPath = CreateUnoService( "com.sun.star.util.PathSettings" )
oDocument = StarDesktop.LoadComponentFromURL("private:factory/scalc", "_blank", 0, oArgs())
...
'Here I save the spreadsheet without problems
oDocument.StoreAsURL(oPath.Work+"/sample.ods", oArgs())
...
'Inserting jpg file in spreadsheet
oLogo = ThisComponent.CreateInstance("com.sun.star.drawing.GraphicObjectShape")
oLogo.GraphicURL = convertToURL("\\SAB-SERV-001\Base de datos\Plantillas\Logo\Logo FLM rojo.jpg")
oSize = oLogo.Size
oSize.Height = 607
oSize.Width = 3757
oLogo.Size = oSize
oPos = oLogo.Position
oPos.X = 1
oPos.Y = 1
oLogo.Position = oPos
oHojaParaLogo = oDocument.DrawPages.getByIndex(0)
oHojaParaLogo.Add(oLogo)
'Just after last intruction (add) I have the exception If I make
oDocument.StoreAsURL(oPath.Work+"/sample1.ods", oArgs())