Microsoft Word Automation boolean



  • From the MS Word Automation documentation.

     

    Syntax

    Visual Basic
    Property KeepWithNext() As Integer

    C#
    int KeepWithNext {get; set;}
    C++
    property Int32 KeepWithNext{
    	Int32 get();
    	Void set(Int32);
    }

    J#
    public int get_KeepWithNext();
    public void set_KeepWithNext(int);

    JScript
    function get KeepWithNext() : int;
    function set KeepWithNext(int);

    Remarks

    This property returns True if the specified paragraph remains on the same page as the paragraph that follows it when Microsoft Word repaginates the document, and False if not. Set the property value to True or False to enable or disable the functionality.

    Possible values are True, False, or wdUndefined.

     



  • pretty hard to have a boolean with 3 values .. since you can have "yes"
    keep it with the next "no" do not keep it with next .. and most likely
    a default (undefined)



  • Possible values are [b]Yes[/b], [b]No[/b], or [b]KindaSorta[/b]



  • These kinds of statements always get me.

    For one, this does not say it is a boolean, but rather an Int.  For another there is no such thing as anything other than a two state boolean.

    This is an enumerator, of which the first two values are representative of true and false.  The only issue I can see is how languages see these values, but even that isn't that big of a deal, since these are language specific examples.

    ANd before anyone says it, there is no tri-state boolean, just an enumerator with only three values.  Keep in mind a boolean is simply a two state enumerator, just like a square is a rectangle, but a rectangle is not a square.



  • It's an int because the representation of a boolean varies from language to language -- as an extreme example, versions of C before C99 don't even have booleans.  On the other hand, the representation of a 32-bit integer is constant across almost all languages.



  • The real WTF is their "C++" example, which is nothing of the sort.



  • There is a valid reason for this. If the propery is accessed in relation to a collection of paragraphs, some of which have 'Keep with next' turn on and some that don't, the result is undefined.



  • In theory a boolean can have three values - "Yes" "No" or "Null".

     Well, that's what I had one DBA-type guy tell me, anyway. My response was roughly "WTF?" *grin*
     



  • Really, shouldn't those values be "True", "False", and "ParagraphNotFound"?



  • Shouldn't use True and False if it's not a bool.

    More like:

    • CurrentPage
    • NextPage
    • NoParagraph

    or something. 



  • [quote user="bugmenot"]The real WTF is their "C++" example, which is nothing of the sort.
    [/quote]

    Looks like C++/CLI.

    It's an attempt to force the MS .NET CLI functionality into C++. The result is a rather pathetic excuse for a language, combining all the flaws of C++ with an awkward interface to the CLI. Its name is also an obvious problem, since while it shares little with C++ anymore, people still tend to abbreviate it to "C++".



  • [quote user="RayS"]Really, shouldn't those values be "True", "False", and "ParagraphNotFound"?
    [/quote]

    I think more likely it should be "True", "False" and "Document not paginated yet". 



  • @Anaerin said:

     

    RayS:
    Really, shouldn't those values be "True", "False", and "ParagraphNotFound"?

    I think more likely it should be "True", "False" and "Document not paginated yet". 

     

    Best really to keep it as wdUndefined.  There are already a shit-ton of wdXXX items in word automation, and if they defined one for all of these functions it would make working with them harder, not easier.



  •  WTF, how did this happen?   I rez year old thread?  Honestly this fucker showed up at the top of the threads list...



  • @tster said:

     WTF, how did this happen?   I rez year old thread?  Honestly this fucker showed up at the top of the threads list...


    I'm guessing someone spammed the thread and the spam message was removed before you saw it .. but the thread kept the date/time of the spamming



  • @tster said:

     WTF, how did this happen?   I rez year old thread?  Honestly this fucker showed up at the top of the threads list...

    In all fairness I saw it in my "not read" lsit (before you posted) too, despite reading it a while back.



  • I get the same thing with the odd thread now and then.

    It's very weird.



  • @dhromed said:

    I get the same thing with the odd thread now and then.

    It's very to be expected from CS.

    FTFY



  • @OzPeter said:

    @tster said:

     WTF, how did this happen?   I rez year old thread?  Honestly this fucker showed up at the top of the threads list...

    I'm guessing someone spammed the thread and the spam message was removed before you saw it .. but the thread kept the date/time of the spamming
    This is precisely what happened.  Even though all new posts are deleted, CS still marks the thread as unread.

  • :belt_onion:

    @tster said:

     WTF, how did this happen?   I rez year old thread?  Honestly this fucker showed up at the top of the threads list...

    Does that mean I'm too late to suggest using Nullable<bool> for true/false/undefined?


  • @dhromed said:

    I get the same thing with the odd thread now and then.

    It's very weird.

    I get the occassional thread that shows "not read" even though it hasn't been updated in several days; just a yellow star appearing randomly halfway down the page in the middle of a sea of gray.  At first I thought it was the mods screwing with stuff, editing something that didn't change the modified time of the thread but updated the "not read" status.  But then I realized CS is just fail, like the diarrhea-splattered walls of an Arby's restroom.



  • @morbiuswilters said:

    the diarrhea-splattered walls of an Arby's restroom
    I do believe you have outdone yourself with your tags this time.  Congrats.



  • @bjolling said:

    @tster said:

     WTF, how did this happen?   I rez year old thread?  Honestly this fucker showed up at the top of the threads list...

    Does that mean I'm too late to suggest using Nullable<bool> for true/false/undefined?
    You haven't used Word automation have you? 


  • @morbiuswilters said:

    <speculation on the role of horsey sauce in the defilement of the men's room at Arby's>

     

    I'd always assumed that sort of explosive reaction was part of their raw materials recycling and reclamation program.  Are you sure you didn't wander into the kitchen by mistake?  Sometimes it's hard to tell them apart.


  • :belt_onion:

    @tster said:

    @bjolling said:

    @tster said:

     WTF, how did this happen?   I rez year old thread?  Honestly this fucker showed up at the top of the threads list...

    Does that mean I'm too late to suggest using Nullable<bool> for true/false/undefined?
    You haven't used Word automation have you? 
    I went through the misery that is called Primary Interop Assemblies (PIA), also commonly referred to as "Pain In the Ass"


  • @Justice said:

    @morbiuswilters said:

    <speculation on the role of horsey sauce in the defilement of the men's room at Arby's>

     

    I'd always assumed that sort of explosive reaction was part of their raw materials recycling and reclamation program.  Are you sure you didn't wander into the kitchen by mistake?  Sometimes it's hard to tell them apart.

     

    Thanks asshole, I can never eat at Arby's again :(



  • @amischiefr said:

    @Justice said:

    @morbiuswilters said:

    <speculation on the role of horsey sauce in the defilement of the men's room at Arby's>

     

    I'd always assumed that sort of explosive reaction was part of their raw materials recycling and reclamation program.  Are you sure you didn't wander into the kitchen by mistake?  Sometimes it's hard to tell them apart.

     

    Thanks asshole, I can never eat at Arby's again :(

    That's hardly a loss.


  • @bstorer said:

    Each roast beef is lovingly hand-molested just after cooking to seal in the juices
    You say this like it makes the meat less desirable.  I like my meat slow molested for 3 hours, no less.



  • @bugmenot said:

    The real WTF is their "C++" example, which is nothing of the sort.

    I'll trouble you to remember that The Real WTF is a registered trademark. Here's an example of its correct use:

    "The Real WTF (tm) is that the whole thing was written by Indian toddlers using a language called 'Wooby.'"

    And yes, their C++ example is wack. I'm pretty sure that even "managed" C++ (ugh) doesn't have a "Void" (with a capital V) keyword.



  • @bridget99 said:

    @bugmenot said:

    The real WTF is their "C++" example, which is nothing of the sort.

    I'll trouble you to remember that The Real WTF is a registered trademark. Here's an example of its correct use:

    "The Real WTF (tm) (R) is that the whole thing was written by Indian toddlers using a language called 'Wooby.'"

    Registered trademark fail.

Log in to reply