LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Libreoffice function to insert colour in a cell (https://www.linuxquestions.org/questions/programming-9/libreoffice-function-to-insert-colour-in-a-cell-4175496224/)

CollieJim 02-25-2014 11:32 PM

Libreoffice function to insert colour in a cell
 
Hi,

I have a spreadsheet with a large number of RGB triplets.
I want to write a function that will take 3 numbers and change the colour of the cell to that RGB value.

Is it possible, and if so, where do I look to get started?

Thanks,
Jim

goumba 02-26-2014 06:23 AM

I did this using a LibreOffice Basic script a few years back. Unfortunately I have lost that script, but this is similar to what I did:

http://stackoverflow.com/questions/1...in-libreoffice

replace:
Code:

Doc = ThisComponent
Sheet = Doc.Sheets(1)

Cell = Sheet.getCellByPosition(0, 0)

with

Code:

Doc = ThisComponent
Cell = Doc.getCurrentSelection

Whatever name you give the function, you'll call it as a formula. So, if you call the function ChangeRGB", the formula you would enter is "=CHANGERGB()"

Hope this helps you, or at least gets you a start.

CollieJim 02-26-2014 09:48 AM

Thanks, but when I try to get help on Basic, the page says it is no longer used, and that the API has to be used now which is a lot more complicated.


All times are GMT -5. The time now is 09:44 AM.