FormulaEngineer — A Highly Accurate Excel Formula Engine with support for 430+ Excel functions — explore the complete list NEW3.0.1

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
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.