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
Centred title with merged cells
Merges four cells into a single banner and centres a 16pt title both horizontally and vertically inside it, then writes a normal header row underneath.
Write.cs
using FormulaEngineer.Api;
using FormulaEngineer.Api.Styling;
using FormulaEngineer.Licensing;
var titleStyle =
ExcelStyle.Default.With(
font: ExcelFontStyle.Default.With(
bold: true,
size: 16d,
color: ExcelColor.FromRgb(255, 255, 255)),
fill: ExcelFillStyle.Solid(
ExcelColor.FromRgb(0, 112, 160)),
alignment: ExcelAlignmentStyle.Default.With(
horizontal: ExcelHorizontalAlignment.Center,
vertical: ExcelVerticalAlignment.Center));
var headerStyle =
ExcelStyle.Default.With(
font: ExcelFontStyle.Bold,
alignment: ExcelAlignmentStyle.Default.With(
horizontal: ExcelHorizontalAlignment.Center));
using (var writer = new ExcelStyledWriter("merged-title-report.xlsx"))
{
using (var sheet = writer.CreateWorksheet("Summary"))
{
sheet.MergeCells(1, 1, 1, 4);
sheet.WriteRow(
new object?[] { "Monthly Sales Summary" },
titleStyle);
sheet.WriteRow();
sheet.WriteRow(
new object?[] { "Month", "North", "South", "Total" },
headerStyle);
sheet.WriteRow("Jan", 12000, 9800, 21800);
sheet.WriteRow("Feb", 13500, 10200, 23700);
}
writer.Close();
}
Style your own workbooks
Styling is part of the same package — no separate install, no Excel, no COM automation.