Talk:Documentation/BASIC Guide/More Than Text

From Apache OpenOffice Wiki
Jump to: navigation, search

Python samples and Images

Can we get some translation of these scripts for the Python language and also include samples on inlcuding the handle of objects such as Images. Python quote could be:

from import Size 
def inset_img(): 
   # abstract the objects in varialbes, doc, text and img, note we used the XSCRIPTCONTEXT
   doc = XSCRIPTCONTEXT.getDocument() 
   text = doc.getText() 
   img = doc.createInstance(u'') 
   # load the image from the TextGraphicObject
   img.GraphicURL = "file:///C:/usr/1.png" 
   # specify the dimension of the image
   aSize = Size() 
   aSize.Width = 1000 
   aSize.Height = 1000 
   img.Size = aSize 
   #inser the image in the text area location    
   text.insertTextContent(text.getEnd(), img, False)
Personal tools