Create a page header with page numbers

[Top]  [Chapter]  [Previous]  [Next]

 

This C# code generates a new header, a right tabstop and page numbering:

 

       IWPMemo memo = WPDLLInt1.Memo;

       IWPDataBlock header = memo.BlockAdd(DataBlockKind.wpIsHeader,

                        DataBlockRange.wpraOnAllPages, "", 0);

       if (header!=null)

     {

                        header.Clear();

                        header.WorkOnText = true;

                        IWPTextCursor cursor = memo.TextCursor;

                        memo.CurrAttr.IncludeStyles((int)(WPSTY.BOLD|WPSTY.UNDERLINE));

                        cursor.InputText(" Page ");

                        cursor.InputTabstop(false,

                                memo.PageSize.PageWidth-

                                memo.PageSize.LeftMargin-

                                memo.PageSize.RightMargin,

                                1 , 0);

                        cursor.InputObject(TextObjTypes.wpobjTextObject,"PAGE","",0);

                        cursor.InputText(" of ");

                        cursor.InputObject(TextObjTypes.wpobjTextObject,"NUMPAGES","",0);

                          cursor.InputText(" ");

       }

 

Result:

 

clip0040


[examplec.htm]    Copyright © 2007 by WPCubed GmbH