Hello,
I am trying to set a cell with 3 different styles (fonts, size) in macro VB.
Is it possible?
How?
[Solved] VB : Different style in a cell
[Solved] VB : Different style in a cell
Last edited by OPENMSA on Fri Sep 12, 2014 10:03 am, edited 1 time in total.
Open Office 3.1.0
on Windows 7
on Windows 7
Re: VB : Different style in a cell
You just do not know what a style is.
https://wiki.openoffice.org/wiki/Docume ... _Templates
https://wiki.openoffice.org/wiki/Docume ... _Templates
Code: Select all
objCell.CellStyle = "My_Sophisticated_Cell_Style_With_Dozends_of_Attributes"Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: VB : Different style in a cell
It seems style apply on the whole cell. Let's forget about style :
I am trying to set a cell with 3 differents fonts & size in macro VB.
Is it possible?
How?
I am trying to set a cell with 3 differents fonts & size in macro VB.
Is it possible?
How?
Open Office 3.1.0
on Windows 7
on Windows 7
Re: VB : Different style in a cell
Hallo
Karolus
Yes, of course -- but what the hell is VBOPENMSA wrote:...in macro VB.
Is it possible?
How?
Code: Select all
def word_formatter():
doc = XSCRIPTCONTEXT.getDocument()
sel = doc.CurrentSelection #works for one single selected Cell !!
cursor = sel.createTextCursor()
sentence = 'just three words'.split()
sizes = (12,20,15)
fonts = ('Carlito', 'Linux Biolinum Keyboard', 'Droid Sans')
for word, size, font in zip(sentence, sizes, fonts):
cursor = cursor.End
cursor.CharHeight = size
cursor.CharFontName = font
cursor.Text.insertString(cursor, '%s ' % word, False)Libreoffice 25.2… on Debian 13 (trixie) (on RaspberryPI5)
Libreoffice 25.8… flatpak on Debian 13 (Bookworm) (on RaspberryPI5)
Libreoffice 25.8… flatpak on Debian 13 (Bookworm) (on RaspberryPI5)
Re: VB : Different style in a cell
Thanks you so much, it works!
Tip : change charWeight, charPosture after a insertControlCharacter (LINE_BREAK...)
Tip : change charWeight, charPosture after a insertControlCharacter (LINE_BREAK...)
Open Office 3.1.0
on Windows 7
on Windows 7
Re: VB : Different style in a cell
changeOPENMSA wrote:Thanks you so much, it works!
Tip : change charWeight, charPosture after a insertControlCharacter (LINE_BREAK...)
Code: Select all
'%s 'Code: Select all
'%s\n'Libreoffice 25.2… on Debian 13 (trixie) (on RaspberryPI5)
Libreoffice 25.8… flatpak on Debian 13 (Bookworm) (on RaspberryPI5)
Libreoffice 25.8… flatpak on Debian 13 (Bookworm) (on RaspberryPI5)