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
Registered named style
EnableNamedStylesRegisters a style by name on the writer, then applies it to a whole row. The name appears in Excel's cell styles gallery, so a reader can reuse it after the file is generated.
Write.cs
using FormulaEngineer.Api;
using FormulaEngineer.Api.Styling;
var stylingOptions =
new ExcelStylingOptions
{
EnableNamedStyles = true
};
using (var writer = new ExcelStyledWriter("registered-named-style-report.xlsx", null, stylingOptions))
{
var headerNamedStyle =
writer.RegisterNamedStyle(
ExcelNamedStyle.Create(
"ReportHeader",
ExcelStyle.Default.With(
font: ExcelFontStyle.Default.With(
bold: true,
color: ExcelColor.FromRgb(255, 255, 255)),
fill: ExcelFillStyle.Solid(
ExcelColor.FromRgb(31, 78, 121)))));
using (var sheet = writer.CreateWorksheet("Named Style"))
{
sheet.WriteRowWithNamedStyle(
new object?[] { "Region", "Revenue", "Status" },
headerNamedStyle);
sheet.WriteRow("North", 125000, "Ready");
sheet.WriteRow("South", 98000, "Review");
}
writer.Close();
}
Style your own workbooks
Styling is part of the same package — no separate install, no Excel, no COM automation.