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 Conditional formatting
Highlight a target band
EnableConditionalFormattingUses a Between operator with two bounds to shade margins that fall inside an acceptable range, leaving outliers on either side visually unmarked.
Write.cs
using FormulaEngineer.Api;
using FormulaEngineer.Api.Styling;
var stylingOptions =
new ExcelStylingOptions
{
EnableConditionalFormatting = true
};
var targetBandStyle =
ExcelStyle.Default.With(
fill: ExcelFillStyle.Solid(ExcelColor.FromRgb(221, 235, 247)));
using (var writer = new ExcelStyledWriter("between-band-highlight.xlsx", null, stylingOptions))
{
using (var sheet = writer.CreateWorksheet("Margins"))
{
sheet.WriteRow("Product", "Margin");
sheet.WriteRow("Formula Engine", 0.18);
sheet.WriteRow("Streaming Writer", 0.09);
sheet.WriteRow("Dashboard Pack", 0.22);
sheet.WriteRow("Support Plan", 0.15);
sheet.AddConditionalFormat(
"B2:B5",
ExcelConditionalFormat.CellValue(
ExcelConditionalFormatOperator.Between,
"0.10",
"0.20",
style: targetBandStyle));
}
writer.Close();
}
Style your own workbooks
Styling is part of the same package — no separate install, no Excel, no COM automation.