Example #1
0
        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();
        }
Example #2
0
        // 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);
        }
Example #3
0
        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());
        }