Beispiel #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>();
            }
        }