By Basic Code: Get & Set color attributes

Discuss the spreadsheet application
Post Reply
tritama
Posts: 2
Joined: Sun Apr 27, 2008 12:12 pm

By Basic Code: Get & Set color attributes

Post by tritama »

This is a coding question. I have series of sheets dealing with student, teacher, tuition and schedule data that are all interlinked (Yes, I realize in would be better in a database, that is the next step later). One sheet is a class schedule display grid and I need various cells on this sheet to take the foreground and background colors from other cells in another sheet using Basic programming. I just need basic tips on how to pull that info from one cell and set it in another. I am sure it is fairly simple and any guidance would be appreciated.
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: By Basic Code: Get & Set color attributes

Post by Villeroy »

This is the wrong forum for this type of questions. Did you notice that Calc has an extremely powerful cell function named STYLE? It can be used together with lookups to calculate all sorts of conditional formattings not limited to 3 conditions like in Format>Conditional...

http://user.services.openoffice.org/en/ ... php?id=667
http://user.services.openoffice.org/en/ ... hp?id=1003

In any case you need a set of styles.
In a script you would state:

Code: Select all

obj.Style = "green_on_red"
where obj can be a cell, a range or a collection of ranges and "green_on_red" is the name of a cell style.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
tritama
Posts: 2
Joined: Sun Apr 27, 2008 12:12 pm

Re: By Basic Code: Get & Set color attributes

Post by tritama »

My apologies to posting in the wrong area. What would be the correct forum to post this questions and other programming question. I am rather new to this site and still trying to find my way around.

I will check out your suggestion, thanks for your help Villeroy.
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: By Basic Code: Get & Set color attributes

Post by Villeroy »

Board Index > Macros and UNO API
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply