Exemplo n.º 1
0
        public void InsertPageNumbers(bool fromTopPage, PageNumberAlignment horizontalAlignment)
        {
            HeaderFooter footer    = fromTopPage ? (base.OwnerBase as Section).HeadersFooters.Header : (base.OwnerBase as Section).HeadersFooters.Footer;
            IParagraph   paragraph = null;
            IField       field2    = null;
            int          num       = 0;
            int          count     = footer.Paragraphs.Count;

            while (num < count)
            {
                Field field;
                paragraph = footer.Paragraphs[num];
                int num2 = 0;
                int num3 = paragraph.Items.Count;
                while (num2 < num3)
                {
                    if (paragraph.Items[num2].DocumentObjectType == DocumentObjectType.Field)
                    {
                        field = (Field)paragraph.Items[num2];
                        if (field.Type == FieldType.FieldPage)
                        {
                            goto Label_00A4;
                        }
                    }
                    num2++;
                }
                goto Label_00A8;
Label_00A4:
                field2 = field;
Label_00A8:
                num++;
            }
            if (field2 == null)
            {
                paragraph = footer.AddParagraph();
                field2    = paragraph.AppendField("", FieldType.FieldPage);
            }
            paragraph.Format.WrapFrameAround = true;
            paragraph.Format.FrameX          = (short)horizontalAlignment;
        }