Example #1
0
 /// <summary>
 /// 设置表头样式
 /// </summary>
 /// <param name="table">表格</param>
 /// <param name="style">单元格样式</param>
 public IExcel HeadStyle(Table table, CellStyle style)
 {
     if (_headStyle == null)
     {
         _headStyle = CellStyleResolver.Resolve(_workbook, style);
     }
     Style(0, table.HeadRowCount - 1, 0, table.ColumnNumber - 1, _headStyle);
     return(this);
 }
Example #2
0
 /// <summary>
 /// 设置页脚样式
 /// </summary>
 /// <param name="table">表格</param>
 /// <param name="style">单元格样式</param>
 public IExcel FootStyle(Table table, CellStyle style)
 {
     if (_footStyle == null)
     {
         _footStyle = CellStyleResolver.Resolve(_workbook, style);
     }
     Style(table.HeadRowCount + table.BodyRowCount, table.Count - 1, 0, table.ColumnNumber - 1, _footStyle);
     return(this);
 }
Example #3
0
        /// <summary>
        /// 创建日期样式
        /// </summary>
        private ICellStyle CreateDateStyle()
        {
            if (_dateStyle != null)
            {
                return(_dateStyle);
            }
            _dateStyle = CellStyleResolver.Resolve(_workbook, CellStyle.Body());
            var format = _workbook.CreateDataFormat();

            _dateStyle.DataFormat = format.GetFormat(_dateFormat);
            return(_dateStyle);
        }