Esempio n. 1
0
        public XLPageSetup(XLPageSetup defaultPageOptions, XLWorksheet worksheet)
        {
            if (defaultPageOptions != null)
            {
                PrintAreas                = new XLPrintAreas(defaultPageOptions.PrintAreas as XLPrintAreas, worksheet);
                CenterHorizontally        = defaultPageOptions.CenterHorizontally;
                CenterVertically          = defaultPageOptions.CenterVertically;
                FirstPageNumber           = defaultPageOptions.FirstPageNumber;
                HorizontalDpi             = defaultPageOptions.HorizontalDpi;
                PageOrientation           = defaultPageOptions.PageOrientation;
                VerticalDpi               = defaultPageOptions.VerticalDpi;
                FirstRowToRepeatAtTop     = defaultPageOptions.FirstRowToRepeatAtTop;
                LastRowToRepeatAtTop      = defaultPageOptions.LastRowToRepeatAtTop;
                FirstColumnToRepeatAtLeft = defaultPageOptions.FirstColumnToRepeatAtLeft;
                LastColumnToRepeatAtLeft  = defaultPageOptions.LastColumnToRepeatAtLeft;
                ShowComments              = defaultPageOptions.ShowComments;


                PaperSize  = defaultPageOptions.PaperSize;
                _pagesTall = defaultPageOptions.PagesTall;
                _pagesWide = defaultPageOptions.PagesWide;
                _scale     = defaultPageOptions.Scale;


                if (defaultPageOptions.Margins != null)
                {
                    Margins = new XLMargins
                    {
                        Top    = defaultPageOptions.Margins.Top,
                        Bottom = defaultPageOptions.Margins.Bottom,
                        Left   = defaultPageOptions.Margins.Left,
                        Right  = defaultPageOptions.Margins.Right,
                        Header = defaultPageOptions.Margins.Header,
                        Footer = defaultPageOptions.Margins.Footer
                    };
                }
                AlignHFWithMargins       = defaultPageOptions.AlignHFWithMargins;
                ScaleHFWithDocument      = defaultPageOptions.ScaleHFWithDocument;
                ShowGridlines            = defaultPageOptions.ShowGridlines;
                ShowRowAndColumnHeadings = defaultPageOptions.ShowRowAndColumnHeadings;
                BlackAndWhite            = defaultPageOptions.BlackAndWhite;
                DraftQuality             = defaultPageOptions.DraftQuality;
                PageOrder = defaultPageOptions.PageOrder;

                ColumnBreaks    = defaultPageOptions.ColumnBreaks.ToList();
                RowBreaks       = defaultPageOptions.RowBreaks.ToList();
                Header          = new XLHeaderFooter(defaultPageOptions.Header as XLHeaderFooter, worksheet);
                Footer          = new XLHeaderFooter(defaultPageOptions.Footer as XLHeaderFooter, worksheet);
                PrintErrorValue = defaultPageOptions.PrintErrorValue;
            }
            else
            {
                PrintAreas   = new XLPrintAreas(worksheet);
                Header       = new XLHeaderFooter(worksheet);
                Footer       = new XLHeaderFooter(worksheet);
                ColumnBreaks = new List <Int32>();
                RowBreaks    = new List <Int32>();
            }
        }
        public XLPageSetup(XLPageSetup defaultPageOptions, XLWorksheet worksheet)
        {
            
            if (defaultPageOptions != null)
            {
                PrintAreas = new XLPrintAreas(defaultPageOptions.PrintAreas as XLPrintAreas, worksheet);
                CenterHorizontally = defaultPageOptions.CenterHorizontally;
                CenterVertically = defaultPageOptions.CenterVertically;
                FirstPageNumber = defaultPageOptions.FirstPageNumber;
                HorizontalDpi = defaultPageOptions.HorizontalDpi;
                PageOrientation = defaultPageOptions.PageOrientation;
                VerticalDpi = defaultPageOptions.VerticalDpi;

                PaperSize = defaultPageOptions.PaperSize;
                _pagesTall = defaultPageOptions.PagesTall;
                _pagesWide = defaultPageOptions.PagesWide;
                _scale = defaultPageOptions.Scale;
                

                if (defaultPageOptions.Margins != null)
                {
                    Margins = new XLMargins
                                  {
                                Top = defaultPageOptions.Margins.Top,
                                Bottom = defaultPageOptions.Margins.Bottom,
                                Left = defaultPageOptions.Margins.Left,
                                Right = defaultPageOptions.Margins.Right,
                                Header = defaultPageOptions.Margins.Header,
                                Footer = defaultPageOptions.Margins.Footer
                            };
                }
                AlignHFWithMargins = defaultPageOptions.AlignHFWithMargins;
                ScaleHFWithDocument = defaultPageOptions.ScaleHFWithDocument;
                ShowGridlines = defaultPageOptions.ShowGridlines;
                ShowRowAndColumnHeadings = defaultPageOptions.ShowRowAndColumnHeadings;
                BlackAndWhite = defaultPageOptions.BlackAndWhite;
                DraftQuality = defaultPageOptions.DraftQuality;
                PageOrder = defaultPageOptions.PageOrder;

                ColumnBreaks = defaultPageOptions.ColumnBreaks.ToList();
                RowBreaks = defaultPageOptions.RowBreaks.ToList();
                Header = new XLHeaderFooter(defaultPageOptions.Header as XLHeaderFooter, worksheet);
                Footer = new XLHeaderFooter(defaultPageOptions.Footer as XLHeaderFooter, worksheet);
                PrintErrorValue = defaultPageOptions.PrintErrorValue;
            }
            else
            {
                PrintAreas = new XLPrintAreas(worksheet);
                Header = new XLHeaderFooter(worksheet);
                Footer = new XLHeaderFooter(worksheet);
                ColumnBreaks = new List<Int32>();
                RowBreaks = new List<Int32>();
            }
        }
Esempio n. 3
0
        public XLWorksheet(String sheetName, XLWorkbook workbook)
            : base(new XLRangeAddress(
                    new XLAddress(null, XLHelper.MinRowNumber, XLHelper.MinColumnNumber, false, false),
                    new XLAddress(null, XLHelper.MaxRowNumber, XLHelper.MaxColumnNumber, false, false)))
        {
            EventTrackingEnabled = workbook.EventTracking == XLEventTracking.Enabled;

            RangeShiftedRows = new XLReentrantEnumerableSet<XLCallbackAction>();
            RangeShiftedColumns = new XLReentrantEnumerableSet<XLCallbackAction>();

            RangeAddress.Worksheet = this;
            RangeAddress.FirstAddress.Worksheet = this;
            RangeAddress.LastAddress.Worksheet = this;

            NamedRanges = new XLNamedRanges(workbook);
            SheetView = new XLSheetView();
            Tables = new XLTables();
            Hyperlinks = new XLHyperlinks();
            DataValidations = new XLDataValidations();
            PivotTables = new XLPivotTables();
            Protection = new XLSheetProtection();
            AutoFilter = new XLAutoFilter();
            ConditionalFormats = new XLConditionalFormats();
            Workbook = workbook;
            SetStyle(workbook.Style);
            Internals = new XLWorksheetInternals(new XLCellsCollection(), new XLColumnsCollection(),
                                                 new XLRowsCollection(), new XLRanges());
            PageSetup = new XLPageSetup((XLPageSetup)workbook.PageOptions, this);
            Outline = new XLOutline(workbook.Outline);
            _columnWidth = workbook.ColumnWidth;
            _rowHeight = workbook.RowHeight;
            RowHeightChanged = Math.Abs(workbook.RowHeight - XLWorkbook.DefaultRowHeight) > XLHelper.Epsilon;
            Name = sheetName;
            SubscribeToShiftedRows((range, rowsShifted) => this.WorksheetRangeShiftedRows(range, rowsShifted));
            SubscribeToShiftedColumns((range, columnsShifted) => this.WorksheetRangeShiftedColumns(range, columnsShifted));
            Charts = new XLCharts();
            ShowFormulas = workbook.ShowFormulas;
            ShowGridLines = workbook.ShowGridLines;
            ShowOutlineSymbols = workbook.ShowOutlineSymbols;
            ShowRowColHeaders = workbook.ShowRowColHeaders;
            ShowRuler = workbook.ShowRuler;
            ShowWhiteSpace = workbook.ShowWhiteSpace;
            ShowZeros = workbook.ShowZeros;
            RightToLeft = workbook.RightToLeft;
            TabColor = XLColor.NoColor;
            SelectedRanges = new XLRanges();

            Author = workbook.Author;

            Pictures = new XLPictures();
        }