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 Layout
Worksheet default style
Sets one style as the sheet-wide default so every cell inherits the same font and fill, then derives the header style from it with With(...) rather than rebuilding it.
Write.cs
using FormulaEngineer.Api;
using FormulaEngineer.Api.Styling;
var defaultStyle =
ExcelStyle.Default.With(
font: ExcelFontStyle.Default.With(name: "Calibri", size: 11d),
fill: ExcelFillStyle.Solid(
ExcelColor.FromRgb(242, 242, 242)));
var headerStyle =
defaultStyle.With(
font: ExcelFontStyle.Default.With(bold: true),
fill: ExcelFillStyle.Solid(
ExcelColor.FromRgb(221, 235, 247)));
using (var writer = new ExcelStyledWriter("worksheet-default-style.xlsx"))
{
using (var sheet = writer.CreateWorksheet("Default Style"))
{
sheet.SetDefaultStyle(defaultStyle);
sheet.WriteRow(
new object?[] { "Department", "Owner", "Status" },
headerStyle);
sheet.WriteRow("Finance", "Asha", "Ready");
sheet.WriteRow("Sales", "Rahul", "Pending");
sheet.WriteRow("Support", "John", "Ready");
}
writer.Close();
}
Style your own workbooks
Styling is part of the same package — no separate install, no Excel, no COM automation.