Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
270967f3
Kaydet (Commit)
270967f3
authored
Şub 17, 2013
tarafından
Xisco Fauli
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fdo#60670: Create a new document in case there's none
Change-Id: I7e03481beb1d4e60601fd93d787bc7354495e41f
üst
1aadb878
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
HelloWorld.py
scripting/examples/python/HelloWorld.py
+6
-1
No files found.
scripting/examples/python/HelloWorld.py
Dosyayı görüntüle @
270967f3
...
@@ -21,7 +21,12 @@
...
@@ -21,7 +21,12 @@
def
HelloWorldPython
(
):
def
HelloWorldPython
(
):
"""Prints the string 'Hello World(in Python)' into the current document"""
"""Prints the string 'Hello World(in Python)' into the current document"""
#get the doc from the scripting context which is made available to all scripts
#get the doc from the scripting context which is made available to all scripts
model
=
XSCRIPTCONTEXT
.
getDocument
()
desktop
=
XSCRIPTCONTEXT
.
getDesktop
()
model
=
desktop
.
getCurrentComponent
()
#check whether there's already an opened document. Otherwise, create a new one
if
not
hasattr
(
model
,
"Text"
):
model
=
desktop
.
loadComponentFromURL
(
"private:factory/swriter"
,
"_blank"
,
0
,
()
)
#get the XText interface
#get the XText interface
text
=
model
.
Text
text
=
model
.
Text
#create an XTextRange at the end of the document
#create an XTextRange at the end of the document
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment