Exemple #1
0
        protected override Size ArrangeOverride(Size arrangeSize)
        {
            ArrangeHeaderAndFooter();
            double printLeftMargin = PrintLeftMargin;
            double printTopMargin  = PrintTopMargin;
            Size   pageSize        = _pageInfo.GetPageSize();

            if ((_printer.Info.Centering == Centering.Horizontal) || (_printer.Info.Centering == Centering.Both))
            {
                double num3 = (_printer.PrintArea.Width - (pageSize.Width * InnerHorizontalZoomFactor)) / 2.0;
                if (num3 < 0.0)
                {
                    num3 = 0.0;
                }
                printLeftMargin += num3;
            }
            if ((_printer.Info.Centering == Centering.Vertical) || (_printer.Info.Centering == Centering.Both))
            {
                double num4 = (_printer.PrintArea.Height - (pageSize.Height * InnerVerticalZoomFactor)) / 2.0;
                if (num4 < 0.0)
                {
                    num4 = 0.0;
                }
                printTopMargin += num4;
            }
            _excel.Arrange(new Rect(new Point(printLeftMargin, printTopMargin), pageSize));
            if (_border != null)
            {
                _border.Arrange(new Rect(new Point(printLeftMargin - 1.0, printTopMargin - 1.0), new Size(pageSize.Width + 1.0, pageSize.Height + 1.0)));
            }
            return(_printer.PageSize);
        }