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
0ce5e664
Kaydet (Commit)
0ce5e664
authored
Tem 31, 2012
tarafından
Pedro Giffuni
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Python reindent.
üst
383d0ef2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
Capitalise.py
scripting/examples/python/Capitalise.py
+5
-5
TableSample.py
scripting/examples/python/pythonSamples/TableSample.py
+4
-4
No files found.
scripting/examples/python/Capitalise.py
Dosyayı görüntüle @
0ce5e664
...
...
@@ -26,16 +26,16 @@ def getNewString( theString ) :
return
""
# should we tokenize on "."?
if
theString
[
0
]
.
isupper
()
and
len
(
theString
)
>=
2
and
theString
[
1
]
.
isupper
()
:
# first two chars are UC => first UC, rest LC
# first two chars are UC => first UC, rest LC
newString
=
theString
[
0
:
1
]
.
upper
()
+
theString
[
1
:]
.
lower
();
elif
theString
[
0
]
.
isupper
():
# first char UC => all to LC
# first char UC => all to LC
newString
=
theString
.
lower
()
else
:
# all to UC.
newString
=
theString
.
upper
()
return
newString
;
def
capitalisePython
(
):
def
capitalisePython
(
):
"""Change the case of a selection, or current word from upper case, to first char upper case, to all lower case to upper case..."""
import
string
...
...
@@ -51,7 +51,7 @@ def capitalisePython( ):
count
=
xIndexAccess
.
getCount
();
if
(
count
>=
1
):
#ie we have a selection
i
=
0
while
i
<
count
:
while
i
<
count
:
xTextRange
=
xIndexAccess
.
getByIndex
(
i
);
#print "string: " + xTextRange.getString();
theString
=
xTextRange
.
getString
();
...
...
@@ -74,7 +74,7 @@ def capitalisePython( ):
if
newString
:
xTextRange
.
setString
(
newString
);
xSelectionSupplier
.
select
(
xTextRange
);
i
+=
1
i
+=
1
# lists the scripts, that shall be visible inside OOo. Can be omited, if
...
...
scripting/examples/python/pythonSamples/TableSample.py
Dosyayı görüntüle @
0ce5e664
...
...
@@ -36,19 +36,19 @@ def insertTextIntoCell( table, cellName, text, color ):
def
createTable
():
"""creates a new writer document and inserts a table with some data (also known as the SWriter sample)"""
"""creates a new writer document and inserts a table with some data (also known as the SWriter sample)"""
ctx
=
uno
.
getComponentContext
()
smgr
=
ctx
.
ServiceManager
desktop
=
smgr
.
createInstanceWithContext
(
"com.sun.star.frame.Desktop"
,
ctx
)
# open a writer document
doc
=
desktop
.
loadComponentFromURL
(
"private:factory/swriter"
,
"_blank"
,
0
,
()
)
text
=
doc
.
Text
cursor
=
text
.
createTextCursor
()
text
.
insertString
(
cursor
,
"The first line in the newly created text document.
\n
"
,
0
)
text
.
insertString
(
cursor
,
"Now we are in the second line
\n
"
,
0
)
# create a text table
table
=
doc
.
createInstance
(
"com.sun.star.text.TextTable"
)
...
...
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