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
Column and win/loss sparklines
EnableSparklinesTwo sparkline groups over the same data — a column type showing magnitude and a win/loss type showing only sign, which reads positive and negative values very differently.
Write.cs
using FormulaEngineer.Api;
using FormulaEngineer.Api.Styling;
var stylingOptions =
new ExcelStylingOptions
{
EnableSparklines = true
};
using (var writer = new ExcelStyledWriter("column-and-winloss-sparklines.xlsx", null, stylingOptions))
{
using (var sheet = writer.CreateWorksheet("Sparkline Types"))
{
sheet.AddSparklineGroup(
ExcelSparklineGroup.Create(
new[]
{
ExcelSparkline.Create("'Sparkline Types'!$B$2:$E$2", 2, 6),
ExcelSparkline.Create("'Sparkline Types'!$B$3:$E$3", 3, 6)
},
type: ExcelSparklineType.Column,
showHighPoint: true,
showLowPoint: true));
sheet.AddSparklineGroup(
ExcelSparklineGroup.Create(
new[]
{
ExcelSparkline.Create("'Sparkline Types'!$B$2:$E$2", 2, 7),
ExcelSparkline.Create("'Sparkline Types'!$B$3:$E$3", 3, 7)
},
type: ExcelSparklineType.WinLoss,
showNegativePoints: true));
sheet.WriteRow("Region", "Jan", "Feb", "Mar", "Apr", "Column", "Win/Loss");
sheet.WriteRow("North", 4, 7, 3, 9, null, null);
sheet.WriteRow("South", -2, 5, -1, 6, null, null);
}
writer.Close();
}
Style your own workbooks
Styling is part of the same package — no separate install, no Excel, no COM automation.