[Solved] Applying font attributes within a texttable

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
mcmurchy1917
Posts: 23
Joined: Fri Feb 22, 2013 2:15 pm

[Solved] Applying font attributes within a texttable

Post 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
Last edited by Hagar Delest on Wed Aug 16, 2017 10:36 pm, edited 1 time in total.
Reason: tagged [Solved].
Slackware user
User avatar
JohnSUN-Pensioner
Volunteer
Posts: 876
Joined: Fri Jan 14, 2011 1:21 pm
Location: Kyiv, Ukraine

Re: Applying font attributes within a texttable

Post 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
I may not have a lot to give but what I got I'll give to you...
Apache OpenOffice 4.1.5, LibreOffice 6.4.4.2 (x64) on Windows 7
If you think that I did not answer your question, make allowances for my imperfect English
mcmurchy1917
Posts: 23
Joined: Fri Feb 22, 2013 2:15 pm

[Solved]: Applying font attributes within a texttable

Post by mcmurchy1917 »

Hi JohnSUN-Pensioner

Thanks. That was exactly what I was looking for.

Alex
Slackware user
Post Reply