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
Format entire rows from a formula
EnableConditionalFormattingAn expression rule applied across the whole table, using the mixed reference $B2 so every column in a row is formatted based on the value in one of them.
Write.cs
using FormulaEngineer.Api;
using FormulaEngineer.Api.Styling;
var stylingOptions =
new ExcelStylingOptions
{
EnableConditionalFormatting = true
};
var overdueStyle =
ExcelStyle.Default.With(
font: ExcelFontStyle.Default.With(color: ExcelColor.FromRgb(156, 0, 6)),
fill: ExcelFillStyle.Solid(ExcelColor.FromRgb(255, 199, 206)));
using (var writer = new ExcelStyledWriter("formula-expression-overdue-rows.xlsx", null, stylingOptions))
{
using (var sheet = writer.CreateWorksheet("Tasks"))
{
sheet.WriteRow("Task", "Days remaining", "Owner");
sheet.WriteRow("Import workbook", 2, "Asha");
sheet.WriteRow("Review formulas", -1, "Rahul");
sheet.WriteRow("Approve report", 0, "John");
sheet.WriteRow("Send dashboard", -3, "Mira");
sheet.AddConditionalFormat(
"A2:C5",
ExcelConditionalFormat.Expression(
"$B2<0",
overdueStyle));
}
writer.Close();
}
Style your own workbooks
Styling is part of the same package — no separate install, no Excel, no COM automation.