Talk:Documentation/BASIC Guide/More Than Text
From Apache OpenOffice Wiki
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 com.sun.star.awt 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'com.sun.star.text.TextGraphicObject') # 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)