[Solved] Writer: change font and center text in Cells table

Java, C++, C#, Delphi... - Using the UNO bridges
Post Reply
jfpetit
Posts: 13
Joined: Tue Dec 04, 2012 10:48 am

[Solved] Writer: change font and center text in Cells table

Post by jfpetit »

I create an OpenOffice document with Delphi. I insert a table in my document.
My question is : How to change font and to center text into the all the cells of the table?
Thanks for help
Last edited by jfpetit on Wed Dec 05, 2012 8:00 pm, edited 3 times in total.
OpenOffice 3.4.1
Windows XP
FJCC
Moderator
Posts: 9248
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: OOWriter with Delphi How to center text in Cells table

Post by FJCC »

If you want to change only some cells, something like this (in OO Basic) should work.

Code: Select all

oTxtTables = ThisComponent.getTextTables()
oTable = oTxtTables.getByIndex(0)
oCurs = oTable.createCursorByCellName("A1")
oCurs.ParaAdjust = com.sun.star.style.ParagraphAdjust.CENTER
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
jfpetit
Posts: 13
Joined: Tue Dec 04, 2012 10:48 am

Re: OOWriter with Delphi How to center text in Cells table

Post by jfpetit »

Thanks for your answer.
Is it possible to change the font and to center text of all the cells of the table?
Thanks for help
OpenOffice 3.4.1
Windows XP
FJCC
Moderator
Posts: 9248
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: OOWriter How to change font and center text in Cells tab

Post by FJCC »

Code: Select all

oTxtTables = ThisComponent.getTextTables()
oTable = oTxtTables.getByIndex(0)
oCurs = oTable.createCursorByCellName("A1")
oCurs.gotoStart(False)
oCurs.gotoEnd(True)
oCurs.ParaAdjust = com.sun.star.style.ParagraphAdjust.CENTER
oCurs.CharFontName = "Arial"
 
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
jfpetit
Posts: 13
Joined: Tue Dec 04, 2012 10:48 am

Re: OOWriter How to change font and center text in Cells tab

Post by jfpetit »

It works.
Thanks
OpenOffice 3.4.1
Windows XP
Post Reply