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
Pie chart with data labels
EnableChartsA single-series pie with data labels turned on, showing how a composition breakdown differs from the category/value pairing a column chart uses.
Write.cs
using FormulaEngineer.Api;
using FormulaEngineer.Api.Styling;
var stylingOptions =
new ExcelStylingOptions
{
EnableCharts = true
};
using (var writer = new ExcelStyledWriter("pie-chart-summary.xlsx", null, stylingOptions))
{
using (var sheet = writer.CreateWorksheet("Mix"))
{
sheet.WriteRow("Category", "Value");
sheet.WriteRow("Licenses", 58);
sheet.WriteRow("Support", 27);
sheet.WriteRow("Training", 15);
sheet.AddChart(
ExcelChart.Create(
ExcelChartKind.Pie,
ExcelDrawingAnchor.OneCell(4, 2, 420d, 260d),
new[]
{
ExcelChartSeries.Create(
"Share",
"'Mix'!$A$2:$A$4",
"'Mix'!$B$2:$B$4")
},
title: "Revenue mix",
showDataLabels: true));
}
writer.Close();
}
Style your own workbooks
Styling is part of the same package — no separate install, no Excel, no COM automation.