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
4
examples
in Images and shapes
Embedded PNG image
EnableImagesEmbeds image bytes directly into the workbook and anchors them to a single cell at a fixed pixel size, so the image travels inside the .xlsx rather than as an external link.
Write.cs
using FormulaEngineer.Api;
using FormulaEngineer.Api.Styling;
using System;
var stylingOptions =
new ExcelStylingOptions
{
EnableImages = true
};
byte[] logoPng =
Convert.FromBase64String(
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+/p9sAAAAASUVORK5CYII=");
using (var writer = new ExcelStyledWriter("embedded-png-image.xlsx", null, stylingOptions))
{
using (var sheet = writer.CreateWorksheet("Image"))
{
sheet.WriteRow("Report with embedded PNG");
sheet.AddImage(
ExcelImage.Create(
logoPng,
ExcelImageFormat.Png,
ExcelDrawingAnchor.OneCell(
column: 3,
row: 2,
widthPixels: 160d,
heightPixels: 80d),
name: "Embedded PNG"));
}
writer.Close();
}
Style your own workbooks
Styling is part of the same package — no separate install, no Excel, no COM automation.