Auto Calculate RGB color using cell references R G B values

Discuss the spreadsheet application
Post Reply
User avatar
IsabelDalhousie
Posts: 20
Joined: Thu Aug 10, 2017 2:12 am

Auto Calculate RGB color using cell references R G B values

Post by IsabelDalhousie »

Hello All ... I'm trying to create a spreadsheet showing a list of custom RGB colors in the cell backgrounds. I've figured out I can do this by manually creating each new RGB value in the color pallet - then applying it. BUT my challenge is I have many to create and I feel this should be possible (and more transparent for editing ) by simply listing the R, G, B values in separate cells and then asking OO to use these references to go fetch the RGB cell background color and apply it. Can anyone give me guidance on how to get there easily? Thanks in advance,

Isabel
Apache OpenOffice 4.1.5 running on macOS High Sierra 10.13.6 Arizona time zone
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Auto Calculate RGB color using cell references R G B val

Post by Villeroy »

download/file.php?id=14875 includes a macro on Module2 which generates styles from a cell range selection.

Copy Module2 to your document or to the global name space ("My Macros")
Create a user-defined cell style. In the example document it is style "Black" according to the constant cParent="Black" on Module2.
Select 2 columns of cells where the first column contains style names and the second contains integer numbers derived from RGB hexadecimals.
Call the "Main" routine.
Another macro "cleanUpStyles" deletes all styles below the parent style keeping all the other styles which have nothing to do with that macro.
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
User avatar
IsabelDalhousie
Posts: 20
Joined: Thu Aug 10, 2017 2:12 am

Re: Auto Calculate RGB color using cell references R G B val

Post by IsabelDalhousie »

Villeroy thank you for your speedy reply. I downloaded the file and confess I'm a little intimidated by the challenge .... but the plot thickens ....

I started by validating what I thought I had already done yesterday - create some new RGB names and colors to add to the basic pallet using open office/preferences/colors ... while doing this I discovered that what I created last night was not stable ... in other words I had created a name and RGB using the drop down and thought I had saved it ... but when I go back in the RGB codes for that name have changed!! There's something that's not intuitive about how to create new colors so since I can't risk the results being incorrect I'm going to abandon this project for now .... I hope I haven't put off other users who may come across this. I may come back to it later. Thanks for your support Villeroy .. happy holidays
Apache OpenOffice 4.1.5 running on macOS High Sierra 10.13.6 Arizona time zone
John_Ha
Volunteer
Posts: 9583
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: Auto Calculate RGB color using cell references R G B val

Post by John_Ha »

LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
User avatar
IsabelDalhousie
Posts: 20
Joined: Thu Aug 10, 2017 2:12 am

Re: Auto Calculate RGB color using cell references R G B val

Post by IsabelDalhousie »

Thanks John, this is helpful as a resource and at least puts my problems in perspective - I only have to manage less than 100 colors!
Apache OpenOffice 4.1.5 running on macOS High Sierra 10.13.6 Arizona time zone
Post Reply