poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Biju <bijumaill...@gmail.com>
Subject Re: How to convert characterRun.getColor() to RGB
Date Sun, 15 Mar 2009 01:33:02 GMT
My previous mail contain some VBA code and a HTML content.
First part of my mail explained how to generate that VBA code and HTML.

Now I will explain how you can use them to find equivalent html color
for a Excel colorIndex.

Method 1
1. Save the HTML content I send you to excel_color.html file.
2. open firefox
3. Install "Computed style" on your firefox toolbar from
4. open excel_color.html in firefox
5. run "Computed style" bookmarklet by clicking it.
6. now you get a "cross" cursor.
7. click a cell you want know the RBG color code.
   - say top left column
   - which in excel is equvalent to A1
8. you see a new window opens and list CSS property
9. one of the CSS propery says "background-color: rgb(0, 0, 0)"
   - now you got the RBG values
10. goto VBA code
11. then search for "A1"
12. you will reach following line
   With Selection.Interior
       .ColorIndex = 1
       .Pattern = xlSolid
   End With
13. from that you can Identyfy the .ColorIndex = 1

Method 2.
1. Save the HTML content I send you to excel_color.html file.
2. open it in a note pad
3. Identify the HTML code which for a cell (say A1)
   - In this case it is

    <td height=17 class=xl223297 width=64

4. Identify its class
   in this case "xl223297"

5. search html file again for style definition of "xl223297"
   - you see
       mso-pattern:auto none;

6. Identify CSS attribute for "background"
   - here it is "background:black;"

7. Now find RBG from table at

8. Now goto VBA code

9. Search for "A1"
   - you reach
   With Selection.Interior
       .ColorIndex = 1
       .Pattern = xlSolid
   End With

10. below that you see ".ColorIndex = 1"
    - that is equvalent Excel color code.

On Sat, Mar 14, 2009 at 6:58 AM, Zsolt Koppany <zkoppanylist@intland.com> wrote:
> Hi Biju,
> sorry, I don't understand what you mean. Can you give me a hint?
> Zsolt
> Biju schrieb:
>> I have generated Excel Macros while editing an excel sheet to add colors.
>> Then I save the sheet as HTML. You can compare VBA code and HTML to
>> find the conversion table.
>> For your convenience i am listing them done.
>> To easily find color in html you can use "computed styles" bookmarklet
>> from
>> https://www.squarefree.com/bookmarklets/webdevel.html
>> PS: If I had some time I should done it in a better way.
>> ie use a VBA macro/POI code to produce excel sheet with color, for
>> colorIndex from 0 to max.
>> Then save the sheet as html. Then put a javascript code to find its RBG
>> value

To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org

View raw message