How can I convert System.Drawing.Color
to Microsoft.Office.Interop.Word.WdColorIndex
?
I have done the code so far, but it's showing the error "overflow".
Here is the code which I have done
Color bgcolor = Color.FromArgb(Convert.ToInt32(innerText));
Microsoft.Office.Interop.Word.WdColorIndex wbgc = (Microsoft.Office.Interop.Word.WdColorIndex)(bgcolor.R + 0x100 * bgcolor.G + 0x10000 * bgcolor.B);
doc.Range(iRangeStart, iRangeEnd).HighlightColorIndex = wbgc;
How can I achieve this?