Ejemplo n.º 1
0
 protected void FormatColumnHeader(DynamicExcelColumn column, Excel.Range headerColumnCell)
 {
     headerColumnCell.Interior.Color    = column.HeaderBackgroundColor;
     headerColumnCell.Font.Color        = column.HeaderFontColor;
     headerColumnCell.ColumnWidth       = column.Width;
     headerColumnCell.Font.Size         = column.FontSize;
     headerColumnCell.Borders.LineStyle = Excel.XlLineStyle.xlContinuous;
     headerColumnCell.Borders.Color     = ColorTranslator.ToOle(Color.SlateGray);
     SetTextAlignment(column, headerColumnCell);
 }
Ejemplo n.º 2
0
        private void SetTextAlignment(DynamicExcelColumn column, Excel.Range headerColumnCell)
        {
            var headerAlignment = column.Alignment.FirstOrDefault();

            if (headerAlignment.Value)
            {
                headerColumnCell.EntireColumn.HorizontalAlignment = headerAlignment.Key;
            }
            else
            {
                headerColumnCell.HorizontalAlignment = headerAlignment.Key;
            }
        }