Beispiel #1
0
        /// <summary>
        /// 生成所有页
        /// </summary>
        void CreatePages()
        {
            Worksheet sheet           = _excel.Sheets[_sheetIndex];
            double    rowHeaderWidth  = 0.0;
            double    colHeaderHeight = 0.0;

            if (sheet.RowHeader.IsVisible)
            {
                rowHeaderWidth = GetTotalWidth(sheet, sheet.RowHeader.ColumnCount, SheetArea.RowHeader);
            }
            if (sheet.ColumnHeader.IsVisible)
            {
                colHeaderHeight = GetTotalHeight(sheet, sheet.ColumnHeader.RowCount, SheetArea.ColumnHeader);
            }
            for (int i = 0; i < _pageIndexs.Count; i++)
            {
                SheetPageInfo info = _paginator.GetPage(i);
                double        chw  = sheet.RowHeader.IsVisible ? (info.ColumnPage.XStart == 0 ? rowHeaderWidth : 0) : 0;
                double        rhh  = sheet.ColumnHeader.IsVisible ? (info.RowPage.YStart == 0 ? colHeaderHeight : 0) : 0;
                _pages.Add(new Rect
                {
                    X      = info.ColumnPage.XStart == 0 ? 0 : info.ColumnPage.XStart + rowHeaderWidth,
                    Y      = info.RowPage.YStart == 0 ? 0 : info.RowPage.YStart + colHeaderHeight,
                    Width  = info.ColumnPage.ContentSize + chw,
                    Height = info.RowPage.ContentSize + rhh
                });
            }
        }
Beispiel #2
0
 public PrintPagePresenter(ExcelPrinter p_printer, int p_index, Excel p_excel, SheetPageInfo p_pageInfo)
 {
     _printer = p_printer;
     _index   = p_index + _printer.Info.FirstPageNumber;
     _excel   = p_excel;
     _excel.ActiveSheetIndex = _printer.SheetIndex;
     _sheet    = _excel.Sheets[_printer.SheetIndex];
     _pageInfo = p_pageInfo;
     OnInit();
 }