Page 1 of 1

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

Posted: Tue Dec 04, 2012 4:11 pm
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

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

Posted: Tue Dec 04, 2012 7:43 pm
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

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

Posted: Wed Dec 05, 2012 9:34 am
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

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

Posted: Wed Dec 05, 2012 3:41 pm
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"
 

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

Posted: Wed Dec 05, 2012 7:59 pm
by jfpetit
It works.
Thanks