FormulaEngineer examples
Create, read, and style Excel workbooks in .NET.
Style workbooks as you write them — fonts, fills, borders,
number formats, alignment, and layout — using
ExcelStyledWriter. Every example below is a complete,
runnable snippet.
Group
Cells and text
10
Layout
10
Conditional formatting
6
Named styles and themes
4
Tables and notes
10
Images and shapes
4
Charts and sparklines
6
Dashboards
4
Example
6
examples
in Charts and sparklines
Integrated dashboard with drawings
EnableImages EnableShapes EnableCharts EnableSparklinesEvery drawing kind on one sheet — an embedded logo, a callout shape, in-cell sparklines, and a two-series chart — all sharing a single drawing part in the package.
Write.cs
using FormulaEngineer.Api;
using FormulaEngineer.Api.Styling;
using System;
var stylingOptions =
new ExcelStylingOptions
{
EnableImages = true,
EnableShapes = true,
EnableCharts = true,
EnableSparklines = true
};
byte[] logoPng =
Convert.FromBase64String(
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+/p9sAAAAASUVORK5CYII=");
using (var writer = new ExcelStyledWriter("integrated-dashboard-with-drawings.xlsx", null, stylingOptions))
{
using (var sheet = writer.CreateWorksheet("Dashboard"))
{
sheet.AddSparklineGroup(
ExcelSparklineGroup.Create(
new[]
{
ExcelSparkline.Create("'Dashboard'!$B$3:$E$3", 3, 6),
ExcelSparkline.Create("'Dashboard'!$B$4:$E$4", 4, 6),
ExcelSparkline.Create("'Dashboard'!$B$5:$E$5", 5, 6)
},
type: ExcelSparklineType.Line,
showMarkers: true,
showHighPoint: true,
showLowPoint: true));
sheet.WriteRow("FormulaEngineer dashboard");
sheet.WriteRow("Region", "Jan", "Feb", "Mar", "Apr", "Trend");
sheet.WriteRow("North", 10, 12, 9, 15, null);
sheet.WriteRow("South", 8, 7, 12, 6, null);
sheet.WriteRow("West", 5, 9, 11, 14, null);
sheet.AddImage(
ExcelImage.Create(
logoPng,
ExcelImageFormat.Png,
ExcelDrawingAnchor.OneCell(8, 2, 90d, 60d),
name: "Dashboard logo"));
sheet.AddShape(
ExcelShape.Create(
ExcelShapeKind.RoundedRectangle,
ExcelDrawingAnchor.OneCell(8, 5, 180d, 70d),
text: ExcelShapeText.Create("Phase 5 visuals"),
name: "Dashboard callout"));
sheet.AddChart(
ExcelChart.Create(
ExcelChartKind.ColumnClustered,
ExcelDrawingAnchor.OneCell(1, 8, 520d, 280d),
new[]
{
ExcelChartSeries.Create("North", "'Dashboard'!$B$2:$E$2", "'Dashboard'!$B$3:$E$3"),
ExcelChartSeries.Create("South", "'Dashboard'!$B$2:$E$2", "'Dashboard'!$B$4:$E$4")
},
title: "Regional performance"));
}
writer.Close();
}
Style your own workbooks
Styling is part of the same package — no separate install, no Excel, no COM automation.