none
How can I set "PageSetup.OddAndEvenPagesHeaderFooter" in C# not in VBA RRS feed

  • Question

  • En,I would try to insert different footers to odd pages and even pages. But when I wanted to set the properity of "OddAndEvenPagesHeaderFooter" in C#. I found it only could be set for a value of INT instead of BOOL. So I tried it in VBA, and I found "OddAndEvenPagesHeaderFooter=True" works well in VBA. However when I tried it in C#, I found "OddAndEvenPagesHeaderFooter=true" works incorrectly. Also when I set "OddAndEvenPagesHeaderFooter=1", I got an error of "Value is not within the expected range'! Could anyone help me??
    Friday, June 28, 2013 2:31 AM

Answers

  • Hi CatenationX

    In the "good old days" (pre-VBA), True = -1, not 1. False has always = 0, never any confusion there...

    When the PIAs "translate" between COM and .NET, Word's True/False almost always are turned into an Integer value on the .Net side, with True = -1. Especially with the parts of the object model that date back to the earliest days. So use -1.


    Cindy Meister, VSTO/Word MVP, my blog

    Friday, June 28, 2013 8:44 PM
    Moderator