excel - R, XLConnect: Setting color with RGB code -


i have come across following problem. lot of data written excel file. within written excel table, want set cell color non-predefined value (which function of number written cell). e.g.: higher number in given cell, greener cell.

i know solutions exist package xlsx (see here , here). use xlconnect throughout entire project , not want convert of code have far.

currently, use following code set cell color:

# create excel workbook wb <- loadworkbook("filename.xls", create=true)`  # create cellstyle yellow solid foreground cellcolor <- createcellstyle(wb) setfillpattern(cellcolor, fill = xlc$"fill.solid_foreground") setfillforegroundcolor(cellcolor, color = xlc$"color.yellow")  # apply cellstyle given cell, here: (10,10) setcellstyle(wb, sheet=sheetname, row=10, col=10, cellstyle=cellcolor)  # save workbook saveworkbook(wb) 

obviously, problematic part

color = xlc$"color.yellow" 

because not let me set rgb code of color like. attempts like

color = rgb(0.2,0.4,0.8) 

fail.

the xlconnect documentation on page 91 tell

the color specified via corresponding color constant xlc object.

there no explanation on how use rgb code.


Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -