Example #1
0
        internal ExcelStyle(ExcelStyles styles, OfficeOpenXml.XmlHelper.ChangedEventHandler ChangedEvent, int positionID, string Address, int xfsId) :
            base(styles, ChangedEvent, positionID, Address)
        {
            Index = xfsId;
            ExcelXfs xfs;

            if (positionID > -1)
            {
                xfs = _styles.CellXfs[xfsId];
            }
            else
            {
                if (_styles.CellStyleXfs.Count == 0)   //CellStyleXfs.Count should never be 0, but for some custom build sheets this can happend.
                {
                    var item = _styles.CellXfs[0].Copy();
                    _styles.CellStyleXfs.Add(item.Id, item);
                }
                xfs = _styles.CellStyleXfs[xfsId];
            }
            Styles       = styles;
            PositionID   = positionID;
            Numberformat = new ExcelNumberFormat(styles, ChangedEvent, PositionID, Address, xfs.NumberFormatId);
            Font         = new ExcelFont(styles, ChangedEvent, PositionID, Address, xfs.FontId);
            Fill         = new ExcelFill(styles, ChangedEvent, PositionID, Address, xfs.FillId);
            Border       = new Border(styles, ChangedEvent, PositionID, Address, xfs.BorderId);
        }
Example #2
0
 internal ExcelStyle(ExcelStyles styles, OfficeOpenXml.XmlHelper.ChangedEventHandler ChangedEvent, int PositionID, string Address, int xfsId)
     : base(styles, ChangedEvent, PositionID, Address)
 {
     Index = xfsId;
     ExcelXfs xfs = _styles.CellXfs[xfsId];
     Numberformat = new ExcelNumberFormat(styles, ChangedEvent, PositionID, Address, xfs.NumberFormatId);
     Font = new ExcelFont(styles, ChangedEvent, PositionID, Address, xfs.FontId);
     Fill = new ExcelFill(styles, ChangedEvent, PositionID, Address, xfs.FillId);
     Border = new Border(styles, ChangedEvent, PositionID, Address, xfs.BorderId);
 }
        internal ExcelStyle(ExcelStyles styles, XmlHelper.ChangedEventHandler ChangedEvent, int positionID, string Address, int xfsId) : base(styles,
                                                                                                                                              ChangedEvent, positionID, Address)
        {
            Index = xfsId;
            if (positionID > -1)
            {
                _xfs = _styles.CellXfs[xfsId];
            }
            else
            {
                _xfs = _styles.CellStyleXfs[xfsId];
            }

            Styles       = styles;
            PositionID   = positionID;
            Numberformat = new ExcelNumberFormat(styles, ChangedEvent, PositionID, Address, _xfs.NumberFormatId);
            Font         = new ExcelFont(styles, ChangedEvent, PositionID, Address, _xfs.FontId);
            Fill         = new ExcelFill(styles, ChangedEvent, PositionID, Address, _xfs.FillId);
            Border       = new Border(styles, ChangedEvent, PositionID, Address, _xfs.BorderId);
        }
Example #4
0
 public static ExcelFill SetBackgroundColor(this ExcelFill fill, Color color, ExcelFillStyle patternType = ExcelFillStyle.Solid)
 {
     fill.PatternType = patternType;
     fill.BackgroundColor.SetColor(color);
     return(fill);
 }