EPPlus 5/6/7

Features and technical overview

Charts and Drawings

Charts

EPPlus 5/6/7 supports over 100 new chart styles introduced in Excel 2016. These styles can be easily set by the new StyleManager either using the ePresetChartStyle enum or the Excel ChartStyle number.

                
    //Add a column chart
    var chart = ws.Drawings.AddBarChart("column3dChart", eBarChartType.ColumnClustered3D);
    var serie = chart.Series.Add(ws.Cells[2, 7, 26, 7], ws.Cells[2, 6, 26, 6]);
    serie.Header = "Order Value";
    chart.SetPosition(0, 0, 8, 0);
    chart.SetSize(1000, 300);
    chart.Title.Text = "Column Chart 3D";
    //Set style 9 and Colorful Pallete 3
    chart.StyleManager.SetChartStyle(ePresetChartStyle.Bar3dChartStyle9, ePresetChartColors.ColorfulPalette3);
                
                
Shapes

We have built support for several types of fills

        
//Drawing with a blip fill
drawing = ws.Drawings.AddShape("BlipFill", eShapeStyle.Bevel);
drawing.SetPosition(0, 5, 12, 5);
drawing.SetSize(250, 250);
drawing.Fill.Style = eFillStyle.BlipFill;
                
var image = new Bitmap(FileInputUtil.GetFileInfo("ShapesAndImages", "EPPlusLogo.jpg").FullName);
drawing.Fill.BlipFill.Image = image;
drawing.Fill.BlipFill.Stretch = true;
drawing.Text = "Blip Fill";
            
        

In this example we add a drawing with a pattern fill. EPPlus 5/6 supports several new ways to set colors for drawing objects, like Preset colors, System colors, HSL colors, RGB percentage colors and RGB colors

        
//Drawing with a pattern fill
drawing = ws.Drawings.AddShape("PatternFill", eShapeStyle.SmileyFace);
drawing.SetPosition(0, 5, 4, 5);
drawing.SetSize(250, 250);  
drawing.Fill.Style = eFillStyle.PatternFill;
drawing.Fill.PatternFill.PatternType = eFillPatternStyle.DiagBrick;
drawing.Fill.PatternFill.BackgroundColor.SetPresetColor(ePresetColor.Yellow);
drawing.Fill.PatternFill.ForegroundColor.SetSystemColor(eSystemColor.GrayText);
drawing.Border.Width = 2;
drawing.Border.Fill.Style = eFillStyle.SolidFill;
drawing.Border.Fill.SolidFill.Color.SetHslColor(90, 50, 25);
drawing.Font.Fill.Color = Color.Black;
drawing.Font.Bold = true;
drawing.Text = "Smiley With Pattern Fill";
            
        

The next example adds a gradient fill. The color goes from dark red into a lighter transparant red. Note that last color adds a transparant transform. EPPlus 5/6 supports 28 different color transformations, like Alpa, Tint, Shade, Gamma and HSL and RGB transformations

        
//Drawing with a Gradient fill
drawing = ws.Drawings.AddShape("GradientFill", eShapeStyle.Heart);
drawing.SetPosition(0, 5, 8, 5);
drawing.SetSize(250, 250);
drawing.Fill.Style = eFillStyle.GradientFill;
drawing.Fill.GradientFill.Colors.AddRgb(0, Color.DarkRed);
drawing.Fill.GradientFill.Colors.AddRgb(30, Color.Red);
drawing.Fill.GradientFill.Colors.AddRgbPercentage(65, 100, 0, 0);
drawing.Fill.GradientFill.Colors[2].Color.Transforms.AddAlpha(75);
drawing.Text = "Heart with Gradient";