Page 1 of 1

[Solved] Applying font attributes within a texttable

Posted: Tue Aug 15, 2017 2:25 pm
by mcmurchy1917
I'm planning to have two paragraphs within a cell of a TextTable within a text document. I want to have one of the paragraphs with a font size of 20 and the other 10.

Currently I've set the contents of the cell using this

Code: Select all

oTable.getCellByPosition( iDayOfWeek, sNum ).setString(sDayOfMonth & CHR$(10) & sEvent)	
A step forward would be to be able to manipulate that text for font weight and font size and font name.

I've managed to do this successfully outside the table with this

Code: Select all

oDoc = ThisComponent			  
Cursor = oDoc.currentcontroller.getViewCursor()
mySelection = oText.createTextCursorByRange(Cursor.getStart())
mySelection.gotoStartOfParagraph(false)
mySelection.gotoEndOfParagraph(true)
mySelection.CharFontName="Arial"
mySelection.CharHeight="30"
mySelection.CharWeight = com.sun.star.awt.FontWeight.BOLD
But am at a loss on how to do similar within a texttable. Any suggestions most welcome

Alex

Re: Applying font attributes within a texttable

Posted: Tue Aug 15, 2017 2:57 pm
by JohnSUN-Pensioner
It seems to me that you are looking for something similar to

Code: Select all

	aT = oTable.getCellByPosition( iDayOfWeek, sNum ).getText()
	oENum = aT.createEnumeration()
	oENum.nextElement().CharHeight = 30.0
	While oENum.hasMoreElements()
		oENum.nextElement().CharHeight = 20.0
	Wend

[Solved]: Applying font attributes within a texttable

Posted: Wed Aug 16, 2017 1:47 pm
by mcmurchy1917
Hi JohnSUN-Pensioner

Thanks. That was exactly what I was looking for.

Alex