Home > Software engineering >  MFC operation word page for current page number
MFC operation word page for current page number

Time:09-30

COleVariant covZero (0) (short), covTrue (TRUE) (short);
Wd. M_wdView. SetSeekView (10);//wdSeekCurrentPageFooter=10
Wd. M_wdParagraphFormat=wd. M_wdSel. GetParagraphFormat ();
Wd. M_wdParagraphFormat. SetAlignment (pFrame - & gt; M_dlgPrintSet. M_printInfo. M_PagenumPosition);
//add page
If (pFrame - & gt; M_dlgPrintSet. M_printInfo. M_PagenumType==0)
{
Wd. M_wdSel. TypeText (LPCTSTR (_T (" ")));
}
Else if (pFrame - & gt; M_dlgPrintSet. M_printInfo. M_PagenumType==1)
{
Wd. M_wdSel. TypeText (LPCTSTR (_T (".. ")));
}
Else if (pFrame - & gt; M_dlgPrintSet. M_printInfo. M_PagenumType==2)
{
Wd. M_wdSel. TypeText (LPCTSTR (_T (" - ")));
}
Else if (pFrame - & gt; M_dlgPrintSet. M_printInfo. M_PagenumType==3)
{
Wd. M_wdSel. TypeText (LPCTSTR (_T (" first page ")));
}
Else if (pFrame - & gt; M_dlgPrintSet. M_printInfo. M_PagenumType==4)
{
Wd. M_wdSel. TypeText (LPCTSTR (_T (" the first pp, pp ")));
}

If (pFrame - & gt; M_dlgPrintSet. M_printInfo. M_PagenumType!
=4){
Wd. M_wdSel. MoveLeft (COleVariant ((short) 1), COleVariant ((short) 1), & amp; CovZero);
}
Else if (pFrame - & gt; M_dlgPrintSet. M_printInfo. M_PagenumType==4)
{
Wd. M_wdSel. MoveLeft (COleVariant ((short) 1), COleVariant ((short) 4), & amp; CovZero);
}

Wd. M_wdFields=wd. M_wdSel. The GetFields ();
//add the page number field, the current page number
Int I=wd. M_wdFields. GetCount ();
Wd. M_wdFields. Add (wd) m_wdSel) GetRange (), COleVariant ((short) 33), COleVariant (_T (" PAGE ")), & amp; CovTrue);

If (pFrame - & gt; M_dlgPrintSet. M_printInfo. M_PagenumType==4)
{
Wd. M_wdSel. MoveRight (COleVariant ((short) 1), COleVariant ((short) 3), & amp; CovZero);
//add the page number field, the total number of pages
Wd. M_wdFields. Add (wd) m_wdSel) GetRange (), COleVariant (26) (short), COleVariant (_T (" NUMPAGES ")), & amp; CovTrue);//add the page number field, the total number of pages
}
Wd. M_wdView. SetSeekView (0);//close the header, footer, wdSeekMainDocument=0, back to the master document

CodePudding user response:

Is this experience to share?
  • Related