Click here to Skip to main content
15,886,786 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to convert Word font color (WDColor) to C# equivalent color.

What I have tried:

I googled and did find the conversion for RGB into a Word/Office Color. But I want it reverse.
Posted
Updated 27-Dec-16 1:39am
Comments
[no name] 27-Dec-16 6:53am    
Think about 0xAABBGGRR vs. 0xAARRGGBB where
A Means Alpha
B means Red
G means Green
B means Blue

The first (0xAABBGGRR, used by word) is also called W32 ColRef. Now it's up to you to convert ;)

1 solution

Here are the appropriate methids to use for conversion in both directions:

C#
System.Drawing.ColorTranslator.ToOLE(System.Drawing.Color)
System.Drawing.ColorTranslator.FromOLE(int)
 
Share this answer
 
Comments
Maciej Los 27-Dec-16 7:43am    
5ed!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900