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
Streaming auto-fit columns
Turns on auto-fit for columns whose content length varies widely. Widths are estimated from the values as they stream past, with the supplied width acting as a minimum floor.
Write.cs
using FormulaEngineer.Api;
using FormulaEngineer.Api.Styling;
var headerStyle =
ExcelStyle.Default.With(
font: ExcelFontStyle.Bold,
fill: ExcelFillStyle.Solid(
ExcelColor.FromRgb(221, 235, 247)));
using (var writer = new ExcelStyledWriter("streaming-autofit-columns.xlsx"))
{
using (var sheet = writer.CreateWorksheet("AutoFit"))
{
sheet.SetColumnStyle(1, ExcelColumnStyle.Default.With(width: 10d));
sheet.SetColumnStyle(2, ExcelColumnStyle.Default.With(width: 12d, autoFit: true));
sheet.SetColumnStyle(3, ExcelColumnStyle.Default.With(width: 14d, autoFit: true));
sheet.WriteRow(
new object?[] { "ID", "Customer", "Status note" },
headerStyle);
sheet.WriteRow("C-100", "Northwind Finance", "Ready for review");
sheet.WriteRow("C-200", "Contoso International Holdings", "Generated from a streamed export without loading the workbook into memory");
sheet.WriteRow("C-300", "Fabrikam", "Approved");
}
writer.Close();
}
Style your own workbooks
Styling is part of the same package — no separate install, no Excel, no COM automation.