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
Two-cell anchored image
EnableImagesAnchors an image across a cell range instead of at a fixed size, so it resizes with the rows and columns beneath it, and carries a description for screen readers.
Write.cs
using FormulaEngineer.Api;
using FormulaEngineer.Api.Styling;
using System;
var stylingOptions =
new ExcelStylingOptions
{
EnableImages = true
};
byte[] bannerPng =
Convert.FromBase64String(
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+/p9sAAAAASUVORK5CYII=");
using (var writer = new ExcelStyledWriter("two-cell-anchored-image.xlsx", null, stylingOptions))
{
using (var sheet = writer.CreateWorksheet("Anchors"))
{
sheet.WriteRow("Image placed with a two-cell anchor");
sheet.AddImage(
ExcelImage.Create(
bannerPng,
ExcelImageFormat.Png,
ExcelDrawingAnchor.TwoCell(
fromColumn: 2,
fromRow: 3,
toColumn: 6,
toRow: 9),
name: "Two cell banner",
description: "Image locked to a worksheet range"));
}
writer.Close();
}
Style your own workbooks
Styling is part of the same package — no separate install, no Excel, no COM automation.