Difference between revisions of "Talk:Documentation/BASIC Guide/More Than Text"

From Apache OpenOffice Wiki
Jump to: navigation, search
(Python samples and Images)
(Python samples and Images)
Line 1: Line 1:
 
== Python samples and Images  ==
 
== 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.
+
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:
 +
 
 +
<source lang="Python">
 +
from com.sun.star.awt import Size
 +
 
 +
def inset_img():
 +
  doc = XSCRIPTCONTEXT.getDocument()
 +
  text = doc.getText()
 +
  img = doc.createInstance(u'com.sun.star.text.TextGraphicObject')
 +
   
 +
  img.GraphicURL = "file:///C:/usr/1.png"
 +
  aSize = Size()
 +
  aSize.Width = 1000
 +
  aSize.Height = 1000
 +
  img.Size = aSize
 +
   
 +
  text.insertTextContent(text.getEnd(), img, False)</source>

Revision as of 19:25, 11 July 2008

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(): 
   doc = XSCRIPTCONTEXT.getDocument() 
   text = doc.getText() 
   img = doc.createInstance(u'com.sun.star.text.TextGraphicObject') 
 
   img.GraphicURL = "file:///C:/usr/1.png" 
   aSize = Size() 
   aSize.Width = 1000 
   aSize.Height = 1000 
   img.Size = aSize 
 
   text.insertTextContent(text.getEnd(), img, False)
Personal tools