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
Mixed layout business report
Everything in this group applied to one sheet — fixed and auto-fit widths, a column-level currency style, a hidden internal column, and a taller wrapped row.
Write.cs
using FormulaEngineer.Api;
using FormulaEngineer.Api.Styling;
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)));
var wrappedStyle =
ExcelStyle.Default.With(
alignment: ExcelAlignmentStyle.Default.With(
wrapText: true,
vertical: ExcelVerticalAlignment.Top));
var moneyStyle =
ExcelStyle.Default.With(
numberFormat: ExcelNumberFormatStyle.Custom("$#,##0.00"));
using (var writer = new ExcelStyledWriter("mixed-layout-business-report.xlsx"))
{
using (var sheet = writer.CreateWorksheet("Report"))
{
sheet.SetColumnStyle(1, ExcelColumnStyle.Default.With(width: 14d));
sheet.SetColumnStyle(2, ExcelColumnStyle.Default.With(width: 36d, autoFit: true));
sheet.SetColumnStyle(3, ExcelColumnStyle.Default.With(width: 14d, style: moneyStyle));
sheet.SetColumnStyle(4, ExcelColumnStyle.Default.With(hidden: true));
sheet.WriteRow(
new object?[] { "Code", "Description", "Amount", "Internal" },
headerStyle);
sheet.WriteRowWithLayout(
new object?[]
{
"A-100",
"This row uses a taller wrapped layout while the amount column inherits currency formatting.",
12500m,
"batch-001"
},
ExcelRowStyle.Default.With(height: 42d),
new ExcelStyle?[] { null, wrappedStyle, null, null });
sheet.WriteRow("B-200", "Normal row", 8750m, "batch-002");
}
writer.Close();
}
Style your own workbooks
Styling is part of the same package — no separate install, no Excel, no COM automation.