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
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:
Automatic color. Default; usually black.
Bright green color.
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.
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
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.