none
WdColor to System Color RRS feed

  • Question

  • Hi

    Is there a reliable way to convert word.wdcolor to system.drawing.color in vsto word addin (specially when word.wdcolor returns a negative integer).

    Thanks

    Kulwinder

    Friday, April 1, 2016 12:24 AM

Answers

  • there is only one member in the Word.WdColor enum has negative value which is Word.WdColor.wdColorAutomatic . Definition of this enum clearly says that "Automatic color. Default; usually black". So this means black at all. I tried in a vsto program particularly to test this convertion by using the following line:

    var color = ColorTranslator.FromWin32((int)Word.WdColor.wdColorBrightGreen);
    for negative value it simply set to black color and i tried this line for most of Word.WdColor members. Use the members of ColorTranslator class if the result is not accurate.

    Friday, April 1, 2016 3:27 AM