I'm rather new to C# and find it almost unspeakable that there isn't a simple way for converting an RGB color or system.color to a WdColor!
VB is simple, C# - is it really that hard to do?
I do not want to reference VB in my project.
I'm using this in some word automation project to color a font, e.g.
tmpRange.Find.Replacement.Font.Color = Color.FromArgb(100, 150, 75);
But this above line isn't possible, it needs to be a WdColor.
Color c = Colors.Blue;
var wdc = (Microsoft.Office.Interop.Word.WdColor)(c.R + 0x100 * c.G + 0x10000 * c.B);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With