Thursday, September 06, 2007

Colors in Excel, importing from HTML

Many a solution on the net propose clearing a html page of images, dropdowns, buttons, checkboxes, radiosbuttons, etc and replacing them with text, then outputing the result as an Excel file. Excel is smart enough to understand the simplest HTML and opens the html as an Excel. The user only has to save the file as an XLS and everything is set.

But what about styles? Apparently, Excel does not work with numerically defined colors, but instead it uses a predefined set of 40 colors and displays any numerically defined color as the closest of these 40. It is a drag to see a beautiful page rendered in Excel in only the coarsest of colors.

But, if you are trying to build an "Excel compatible" page, or if you want to use a separate style for the excel export (btw, Excel doesn't understand stylesheets, so you have to save all style in a <STYLE> tag and NOT use multiple class names in the same class property like "class1 class2". Older Excels might not even do that) then you have to use the colors that Excel uses. Here is a list, as taken from my Office 2003:
               
Black
Negru
Maroon
Maro
Dark Olive
Oliv inchis
Dark Green
Verde inchis
Dark Blue
Albastru inchis
Navy Blue
Bleumarin
Indigo 80% Gray
Gri-80%
#000000 #993300 #333300 #003300 #000040 #000080 #333399 #333333
               
Gold Red
Bordo
Orange
Portocaliu
Olive Green
Verde Oliv
Green
Verde
Teal Blue
Albastru Verzui
Blue
Albastru
Gray Blue
Gri albastrui
50% Gray
Gri-50%
#800000 #FF6600 #808000 #008000 #008080 #0000FF #666699 #808080
               
Red
Rosu
Yellow Orange
Galben Portocaliu
Yellow Green
Verde galbui
Sea Green
Verde marin
Cyan Light Blue
Albastru deschis
Violet
Violet
40% Gray
Gri-40%
#FF0000 #FF9900 #99CC00 #339966 #33CCCC #3366FF #800080 #969696
               
Fuchsia
Ciclam
Gold
Auriu
Yellow
Galben
Lime
Verde aprins
Aqua
Turcoaz
Sky Blue
Azuriu
Violet Red
Mov
25% Gray
Gri-25%
#FF00FF #FFCC00 #FFFF00 #00FF00 #00FFFF #00CCFF #993366 #C0C0C0
               
Pink
Roz
Ocre
Ocru
Light Yellow
Galben pal
Light Green
Verde deschis
Light Aqua
Turcoaz deschis
Light Blue
Bleu pastel
Orchid
Lila
White
Alb
#FF99CC #FFCC99 #FFFF99 #CCFFCC #CCFFFF #99CCFF #CC99FF #FFFFFF

0 comments: