[Solved] Applying font attributes within a texttable

Creating a macro - Writing a Script - Using the API

[Solved] Applying font attributes within a texttable

Postby mcmurchy1917 » Tue Aug 15, 2017 2:25 pm

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   Expand viewCollapse view
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   Expand viewCollapse view
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
mcmurchy1917
 
Posts: 22
Joined: Fri Feb 22, 2013 2:15 pm

Re: Applying font attributes within a texttable

Postby JohnSUN-Pensioner » Tue Aug 15, 2017 2:57 pm

It seems to me that you are looking for something similar to
Code: Select all   Expand viewCollapse view
   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.4, LibreOffice 5.4.2.2 (x64) on Windows 7
If you think that I did not answer your question, make allowances for my imperfect English
User avatar
JohnSUN-Pensioner
Volunteer
 
Posts: 761
Joined: Fri Jan 14, 2011 1:21 pm
Location: Kyiv, Ukraine

[Solved]: Applying font attributes within a texttable

Postby mcmurchy1917 » Wed Aug 16, 2017 1:47 pm

Hi JohnSUN-Pensioner

Thanks. That was exactly what I was looking for.

Alex
Slackware user
mcmurchy1917
 
Posts: 22
Joined: Fri Feb 22, 2013 2:15 pm


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 7 guests