[Solved] Change color in macro

Discuss the spreadsheet application
Post Reply
ych
Posts: 2
Joined: Mon Mar 17, 2014 6:43 am

[Solved] Change color in macro

Post by ych »

Hi
help me

i want change font color use basic macro in cell text
but i not want all text
just section text

example
"This is test string"
i want change "test" color
Attachments
test.png
test.png (8.7 KiB) Viewed 744 times
Last edited by Hagar Delest on Tue Mar 18, 2014 12:00 am, edited 1 time in total.
Reason: tagged [Solved].
Linux 2.6 CentOS
Openoffice 3.1.1
FJCC
Moderator
Posts: 9619
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: change color in macro

Post by FJCC »

If the text were in cell A1 of Sheet1

Code: Select all

  oSheets = ThisComponent.getSheets()
  oObj1 = oSheets.getByName("Sheet1")
  oCell = oObj1.getCellRangeByName("A1")

  oText = oCell.getText()
  oObj2 = oText.createTextCursor()
  oObj2.gotoStart(False)
  oObj2.goRight(8, False)
  oObj2.goRight(4, True)
  oObj2.CharColor = RGB(255,0,0)
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.
ych
Posts: 2
Joined: Mon Mar 17, 2014 6:43 am

Re: change color in macro

Post by ych »

Thank You !!
Have a nice day ^^
Linux 2.6 CentOS
Openoffice 3.1.1
Post Reply