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
Clustered column chart
EnableChartsAdds a real Excel chart part backed by a worksheet range, with a title and both axis labels. The chart stays linked to the cells, so editing the data redraws it.
Write.cs
using FormulaEngineer.Api;
using FormulaEngineer.Api.Styling;
var stylingOptions =
new ExcelStylingOptions
{
EnableCharts = true
};
using (var writer = new ExcelStyledWriter("clustered-column-chart.xlsx", null, stylingOptions))
{
using (var sheet = writer.CreateWorksheet("Sales"))
{
sheet.WriteRow("Month", "Revenue");
sheet.WriteRow("Jan", 12000);
sheet.WriteRow("Feb", 14500);
sheet.WriteRow("Mar", 13200);
sheet.WriteRow("Apr", 16800);
sheet.AddChart(
ExcelChart.Create(
ExcelChartKind.ColumnClustered,
ExcelDrawingAnchor.OneCell(4, 2, 420d, 240d),
new[]
{
ExcelChartSeries.Create(
"Revenue",
"'Sales'!$A$2:$A$5",
"'Sales'!$B$2:$B$5")
},
title: "Monthly revenue",
categoryAxisTitle: "Month",
valueAxisTitle: "Revenue"));
}
writer.Close();
}
Style your own workbooks
Styling is part of the same package — no separate install, no Excel, no COM automation.