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 values above a threshold
EnableConditionalFormattingThe simplest conditional format — a cell-value rule that bolds and tints every revenue figure above 1000, evaluated by Excel when the file opens rather than baked in at write time.
Write.cs
using FormulaEngineer.Api;
using FormulaEngineer.Api.Styling;
var stylingOptions =
new ExcelStylingOptions
{
EnableConditionalFormatting = true
};
var highValueStyle =
ExcelStyle.Default.With(
font: ExcelFontStyle.Default.With(bold: true),
fill: ExcelFillStyle.Solid(ExcelColor.FromRgb(226, 239, 218)));
using (var writer = new ExcelStyledWriter("greater-than-threshold-format.xlsx", null, stylingOptions))
{
using (var sheet = writer.CreateWorksheet("Sales"))
{
sheet.WriteRow("Region", "Revenue");
sheet.WriteRow("North", 1250);
sheet.WriteRow("South", 920);
sheet.WriteRow("West", 1480);
sheet.WriteRow("East", 760);
sheet.AddConditionalFormat(
"B2:B5",
ExcelConditionalFormat.CellValue(
ExcelConditionalFormatOperator.GreaterThan,
"1000",
style: highValueStyle));
}
writer.Close();
}
Style your own workbooks
Styling is part of the same package — no separate install, no Excel, no COM automation.