Office enumeration returning incorrect value

In the following code c ends up with the value -16777220 instead of -16777216, as per Microsoft documentation. When I get the color value for a character, or a complete paragraph, that is set to Automatic in the Word document, it returns -16777216 correctly.

I have noticed that in the autocomplete list the wdColorAutomatic shows up as wdColorAutomatic=-1.677722E+7 which inclines me to think there may be some internal rounding error in XOJO. I haven’t tested any other (large) enumeration values at this point. I also tried declaring c as a double and that did not correct the value returned. It seems odd that XOJO would have the number in that format in the autocomplete. I can work around this with my own constant.

dim c as integer
c=office.wdColorAutomatic

Here is another one. I think there is a XOJO problem.
office.wdColorGray05=15987699 according to Microsoft
XOJO autocomplete suggests 1.59877E+7, ie. 15987700

And even worse this one:
office.wdColorBlue=16711680 according to Microsoft but XOJO returns 13893630

I just lost all confidence in these XOJO provided enumeration constants. Fortunately, only the Automatic color value matters to me at the moment and I can get around it. If I’m causing the problem, I have no idea how.

If you assign these values to a variable and look at the variable, what do you see?
It might just be cosmetic in autocomplete

The values are wrong when assigned to a variable. That is how I discovered it. My code depended on the value of wdColorAutomatic being -16777216. The autocomplete display perhaps hints at an internal assumption/problem in Xojo, or in how these constants were incorporated. It also strikes me as odd that the autocomplete displays numbers that are always integers in that manner.

I dont use them, but if it helps, it wouldnt take long to whip up a new set of enums from this:

https://docs.microsoft.com/en-us/dotnet/api/microsoft.office.interop.word.wdcolor?view=word-pia

[quote]eg
wdColorAqua 13421619
Aqua color.

wdColorAutomatic -16777216
Automatic color. Default; usually black.

wdColorBlack 0
Black color.

wdColorBlue 16711680
Blue color.

wdColorBlueGray 10053222
Blue-gray color.

wdColorBrightGreen 65280
Bright green color.

wdColorBrown 13209
Brown color.[/quote]

[quote=430277:@Damien Callaghan]
I have noticed that in the autocomplete list the wdColorAutomatic shows up as wdColorAutomatic=-1.677722E+7 which inclines me to think there may be some internal rounding error in XOJO.
[/code][/quote]
Enums are definitely integers
But these arent enums
Almost looks like they are set up as doubles which would be a problem

If you havent already I’d file a bug report

<https://xojo.com/issue/55305>

Important thing to remember… Xojo uses RGB… but for some reason Microsoft uses BGR (this was discusses in greater detail in a previous topic)

Thanks Dave. I will be getting to a point where that matters.