In vb .net, how to typecast System.Color (or) Color.FromArgb(....) To Microsoft.Office.Interop.Word.WdColor?
Asked
Active
Viewed 725 times
1 Answers
3
You need to convert it to a hexadecimal style RGB:
To quote Cole Cameron's comment from that answer:
Sum the Red, Green, and Blue values of the named color, multiplying the Green & Blue values by hexadecimal modifiers so that the value is effectively 0xBBGGRR (base doesn't really matter, an integer's an integer), then cast that to the WdColor enumeration type.
Example (Converted from Cole Cameron's C# example):
Dim c As Color = Colors.Blue
Dim wdc = DirectCast(c.R + &H100 * c.G + &H10000 * c.B, Microsoft.Office.Interop.Word.WdColor)