Beispiel #1
0
 public XMLStyleModel(CT_Xf xf, StyleManager manager, bool setVerticalAlignment)
 {
     _xf      = xf;
     _manager = manager;
     _font    = (_xf.ApplyFont_Attr ? _manager.GetFont(_xf.FontId_Attr) : new XMLFontModel(_manager.Palette));
     _border  = (_xf.ApplyBorder_Attr ? _manager.GetBorder(_xf.BorderId_Attr) : new XMLBorderModel(_manager.Palette));
     _fill    = (_xf.ApplyFill_Attr ? _manager.GetFill(_xf.FillId_Attr).DeepClone() : new XMLFillModel(_manager.Palette));
     if (setVerticalAlignment)
     {
         Alignment.Vertical_Attr = ST_VerticalAlignment.top;
         Alignment.WrapText_Attr = true;
     }
 }
Beispiel #2
0
        private void Copy(IStyleModel srcStyle)
        {
            XMLStyleModel xMLStyleModel = (XMLStyleModel)srcStyle;

            _hasBeenModified           = xMLStyleModel._hasBeenModified;
            _xf.ApplyAlignment_Attr    = xMLStyleModel._xf.ApplyAlignment_Attr;
            _xf.ApplyBorder_Attr       = xMLStyleModel._xf.ApplyBorder_Attr;
            _xf.ApplyFill_Attr         = xMLStyleModel._xf.ApplyFill_Attr;
            _xf.ApplyFont_Attr         = xMLStyleModel._xf.ApplyFont_Attr;
            _xf.ApplyNumberFormat_Attr = xMLStyleModel._xf.ApplyNumberFormat_Attr;
            _xf.ApplyProtection_Attr   = xMLStyleModel._xf.ApplyProtection_Attr;
            _xf.NumFmtId_Attr          = xMLStyleModel._xf.NumFmtId_Attr;
            if (xMLStyleModel._xf.BorderId_Attr_Is_Specified)
            {
                _xf.BorderId_Attr = xMLStyleModel._xf.BorderId_Attr;
            }
            if (xMLStyleModel._xf.FillId_Attr_Is_Specified)
            {
                _xf.FillId_Attr = xMLStyleModel._xf.FillId_Attr;
            }
            if (xMLStyleModel._xf.FontId_Attr_Is_Specified)
            {
                _xf.FontId_Attr = xMLStyleModel._xf.FontId_Attr;
            }
            if (xMLStyleModel._xf.Alignment != null)
            {
                if (xMLStyleModel._xf.Alignment.Vertical_Attr_Is_Specified)
                {
                    Alignment.Vertical_Attr = xMLStyleModel._xf.Alignment.Vertical_Attr;
                }
                if (xMLStyleModel.Alignment.Horizontal_Attr_Is_Specified)
                {
                    Alignment.Horizontal_Attr = xMLStyleModel._xf.Alignment.Horizontal_Attr;
                }
                if (xMLStyleModel.Alignment.ReadingOrder_Attr_Is_Specified)
                {
                    Alignment.ReadingOrder_Attr = xMLStyleModel._xf.Alignment.ReadingOrder_Attr;
                }
                if (xMLStyleModel.Alignment.WrapText_Attr_Is_Specified)
                {
                    Alignment.WrapText_Attr = xMLStyleModel._xf.Alignment.WrapText_Attr;
                }
                if (xMLStyleModel.Alignment.ShrinkToFit_Attr_Is_Specified)
                {
                    Alignment.ShrinkToFit_Attr = xMLStyleModel._xf.Alignment.ShrinkToFit_Attr;
                }
                if (xMLStyleModel.Alignment.Indent_Attr_Is_Specified)
                {
                    Alignment.Indent_Attr = xMLStyleModel._xf.Alignment.Indent_Attr;
                }
                if (xMLStyleModel.Alignment.JustifyLastLine_Attr_Is_Specified)
                {
                    Alignment.JustifyLastLine_Attr = xMLStyleModel._xf.Alignment.JustifyLastLine_Attr;
                }
                if (xMLStyleModel.Alignment.TextRotation_Attr_Is_Specified)
                {
                    Alignment.TextRotation_Attr = xMLStyleModel._xf.Alignment.TextRotation_Attr;
                }
            }
            if (xMLStyleModel._numberformat != null)
            {
                _numberformat = xMLStyleModel._numberformat;
            }
            if (xMLStyleModel._font != null)
            {
                Font = (XMLFontModel)xMLStyleModel._font.Clone();
            }
            if (xMLStyleModel._fill != null)
            {
                Fill = xMLStyleModel._fill.DeepClone();
            }
            if (xMLStyleModel._border != null)
            {
                _border = xMLStyleModel._border.DeepClone();
            }
        }
 public uint AddBorder(XMLBorderModel model)
 {
     return(_borders.Add(model));
 }