public CODService() { Workbook = new HSSFWorkbook(); BoldFont = Workbook.CreateFont(); BoldFont.IsBold = true; BoldFont.FontName = "Calibri"; BoldFont.FontHeightInPoints = 11; DefaultFont = Workbook.CreateFont(); DefaultFont.FontName = "Calibri"; DefaultFont.FontHeightInPoints = 11; HeadStyle = Workbook.CreateCellStyle(); HeadStyle.SetFont(BoldFont); GreenStyle = Workbook.CreateCellStyle(); GreenStyle.SetFont(DefaultFont); GreenStyle.FillForegroundColor = HSSFColor.LightGreen.Index; GreenStyle.FillPattern = FillPattern.BigSpots; GreenStyle.FillBackgroundColor = HSSFColor.LightGreen.Index; DefaultStyle = Workbook.CreateCellStyle(); DefaultStyle.SetFont(DefaultFont); PresentationService = new PresentationService(); JobService = new JobService(); }
// REVIEW: Merge with AddComponentHeadStyle public static void AddHeadStyle(string componentName, string css) { if (string.IsNullOrWhiteSpace(componentName) || string.IsNullOrWhiteSpace(css)) { return; } if (HeadStyle.ContainsKey(componentName)) { return; } HeadStyle.Add(componentName, css); }
private static string BuildHeadStyle() { if (!HeadStyle.Any()) { return(string.Empty); } StringBuilder sb = new StringBuilder(); foreach (var css in HeadStyle) { if (string.IsNullOrWhiteSpace(css.Value)) { continue; } sb.Append($@"{css.Value}"); } return(sb.ToString()); }