Пример #1
0
        public void ResetNumberingForSection(Section sec)
        {
            object      align     = WdPageNumberAlignment.wdAlignPageNumberOutside;
            object      firstPage = true;
            PageNumbers pageNums  = sec.Headers[WdHeaderFooterIndex.wdHeaderFooterPrimary].PageNumbers;
            PageNumber  pgNum     = pageNums.Add(ref align, ref firstPage);

            pageNums.RestartNumberingAtSection = true;
            pageNums.StartingNumber            = 1;
            pgNum.Delete();
        }
Пример #2
0
        public void Init(int total)
        {
            this.Total = total;
            int pages = (int)Math.Ceiling((double)total / _getPageSize());
            int count = PageNumbers.Count;

            if (pages < count)
            {
                for (int n = pages + 1; n <= count; n++)
                {
                    PageNumbers.Remove(n);
                }
            }
            else
            {
                for (int n = count + 1; n <= pages; n++)
                {
                    PageNumbers.Add(n);
                }
            }
            OnPropertyChanged(nameof(CanPageSub));
            OnPropertyChanged(nameof(CanPageAdd));
        }
Пример #3
0
        /// <summary>
        /// Calculates the total pages.
        /// </summary>
        private void CalculateTotalPages(int currentPage)
        {
            if (itemcount == 0)
            {
                totalPages = 1;
            }
            else if (itemcount % itemPerPage == 0)
            {
                totalPages = (itemcount / itemPerPage);
            }
            else
            {
                totalPages = (itemcount / itemPerPage) + 1;
            }

            PageNumbers.Clear();

            int startPage = currentPage - 5;

            if (startPage <= 0)
            {
                startPage = 1;
            }
            int page = startPage;

addPages:
            PageNumbers.Add(new IntegerComboBoxModel {
                Name = page.ToString(Constants.DefaultCulture), Value = page
            });
            if (totalPages > page & page < (startPage + 9))
            {
                page++;
                goto addPages;
            }
            OnPropertyChanged("CurrentPage");
        }