Word Automation Using MFC

Discussion in 'MFC' started by DeepthiC85, Jul 21, 2010.

  1. DeepthiC85

    DeepthiC85 New Member

    Joined:
    Jul 21, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    I am trying to add different header and footer to the first page of the document using Word Automation in VC++. My code is not erroring out but I am not able to achieve the target. Can someone please help me how to resolve the issue?

    I am providing the code snippet below -

    MSWORD97_View view;
    PageSetup pagesetup;
    window.AttachDispatch(finalDocument.GetActiveWindow());
    view.AttachDispatch(window.GetView());

    //To insert page header -- The below code inserts header text for me.
    const long wdSeekCurrentPageHeader = 9;
    view.SetSeekView(wdSeekCurrentPageHeader);

    window.AttachDispatch(finalDocument.GetActiveWindow());
    selection.AttachDispatch(window.GetSelection());
    selection.PasteSpecial(covOptional, covOptional, covOptional, covOptional, covOptional, covOptional, covOptional) ;

    //PageSetUp -- I am not able to Set the option in the PageSetUp window of the Header&footer one //

    const long nNewValue = 8;
    pagesetup.AttachDispatch(finalDocument.GetPageSetup());
    pagesetup.SetDifferentFirstPageHeaderFooter(4);

    Can someone please correct the code or let me know whats wrong in the above. I am also not able to get what value should be passed to SetDifferentFirstPageHeaderFooter?:confused:

    Please help!!!!!!!:disappoin
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice