Go4Expert

Go4Expert (http://www.go4expert.com/)
-   MFC (http://www.go4expert.com/forums/mfc/)
-   -   Word Automation Using MFC (http://www.go4expert.com/forums/word-automation-using-mfc-t22773/)

DeepthiC85 21Jul2010 15:44

Word Automation Using MFC
 
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.GetActiveWindo w());
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.GetActiveWindo w());
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.GetPageSetu p());
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


All times are GMT +5.5. The time now is 09:33.