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
Protected input sheet
Unlocks the cells a user is meant to edit, hides the formula text on calculated cells, and turns on sheet protection. Cosmetic guidance for the reader, not a security control.
Write.cs
using FormulaEngineer.Api;
using FormulaEngineer.Api.Styling;
var inputStyle =
ExcelStyle.Default.With(
fill: ExcelFillStyle.Solid(
ExcelColor.FromRgb(255, 242, 204)),
protection: ExcelProtectionStyle.Default.With(
locked: false));
var formulaStyle =
ExcelStyle.Default.With(
numberFormat: ExcelNumberFormatStyle.Custom("$#,##0.00"),
protection: ExcelProtectionStyle.Default.With(
formulaHidden: true));
using (var writer = new ExcelStyledWriter("protected-input-sheet.xlsx"))
{
using (var sheet = writer.CreateWorksheet("Protected"))
{
sheet.WriteRow("Item", "Qty", "Unit price", "Total");
sheet.WriteRow(
new object?[] { "License", 2, 499m, ExcelFormula.From("B2*C2") },
new ExcelStyle?[] { null, inputStyle, inputStyle, formulaStyle });
sheet.WriteRow(
new object?[] { "Support", 1, 275m, ExcelFormula.From("B3*C3") },
new ExcelStyle?[] { null, inputStyle, inputStyle, formulaStyle });
sheet.ProtectSheet();
}
writer.Close();
}
Style your own workbooks
Styling is part of the same package — no separate install, no Excel, no COM automation.