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
10
examples
in Cells and text
Highlighted input cells
Marks the cells a user is meant to edit with a pale yellow fill and leaves calculated cells unfilled, so the sheet communicates which values are inputs and which are derived.
Write.cs
using FormulaEngineer.Api;
using FormulaEngineer.Api.Styling;
using FormulaEngineer.Licensing;
var headerStyle =
ExcelStyle.Default.With(
font: ExcelFontStyle.Default.With(
bold: true,
color: ExcelColor.FromRgb(255, 255, 255)),
fill: ExcelFillStyle.Solid(
ExcelColor.FromRgb(31, 78, 121)),
alignment: ExcelAlignmentStyle.Default.With(
horizontal: ExcelHorizontalAlignment.Center));
var inputStyle =
ExcelStyle.Default.With(
fill: ExcelFillStyle.Solid(
ExcelColor.FromRgb(255, 242, 204)));
var currencyStyle =
ExcelStyle.Default.With(
numberFormat: ExcelNumberFormatStyle.Custom("$#,##0.00"));
using (var writer = new ExcelStyledWriter("highlighted-input-cells.xlsx"))
{
using (var sheet = writer.CreateWorksheet("Inputs"))
{
sheet.WriteRow(
new object?[] { "Item", "Quantity", "Unit price", "Total" },
headerStyle);
sheet.WriteRow(
new object?[] { "License", 2, 499m, ExcelFormula.From("B2*C2") },
new ExcelStyle?[] { null, inputStyle, inputStyle, currencyStyle });
sheet.WriteRow(
new object?[] { "Support", 1, 275m, ExcelFormula.From("B3*C3") },
new ExcelStyle?[] { null, inputStyle, inputStyle, currencyStyle });
}
writer.Close();
}
Style your own workbooks
Styling is part of the same package — no separate install, no Excel, no COM automation.