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
4
examples
in Named styles and themes
Per-cell named styles
EnableNamedStylesRegisters two named styles up front and applies them per cell via a named-style array, mixing a currency style and a warning style within a single row.
Write.cs
using FormulaEngineer.Api;
using FormulaEngineer.Api.Styling;
var stylingOptions =
new ExcelStylingOptions
{
EnableNamedStyles = true
};
using (var writer = new ExcelStyledWriter("per-cell-named-styles.xlsx", null, stylingOptions))
{
var moneyStyle =
writer.RegisterNamedStyle(
ExcelNamedStyle.Create(
"Money",
ExcelStyle.Default.With(
numberFormat: ExcelNumberFormatStyle.Custom("$#,##0.00"))));
var warningStyle =
writer.RegisterNamedStyle(
ExcelNamedStyle.Create(
"Warning",
ExcelStyle.Default.With(
font: ExcelFontStyle.Default.With(bold: true),
fill: ExcelFillStyle.Solid(ExcelColor.FromRgb(255, 199, 206)))));
using (var sheet = writer.CreateWorksheet("Named Cells"))
{
sheet.WriteRow("Item", "Amount", "Status");
sheet.WriteRowWithNamedStyles(
new object?[] { "License", 998m, "Approved" },
new ExcelNamedStyle?[] { null, moneyStyle, null });
sheet.WriteRowWithNamedStyles(
new object?[] { "Support", 275m, "Review" },
new ExcelNamedStyle?[] { null, moneyStyle, warningStyle });
}
writer.Close();
}
Style your own workbooks
Styling is part of the same package — no separate install, no Excel, no COM automation.