Spreadsheet | Formatting
What the Home tab’s Font, Alignment, Styles and Cells groups and View ▸ Freeze Panes do beyond
font, fill and number formats (those are on the overview). Every
command is one undo step on SpreadsheetController, and everything is written where Excel expects it.
var controller = view.Controller; // MAUI: Sheet.Controller, Blazor: view.ControllerBorders
Section titled “Borders”Home ▸ Font ▸ Borders — edges, line style and line colour.
controller.BorderLine = ...; // style and colour for the next presetcontroller.ApplyBorders(BorderPreset.ThickOutside);Merge cells
Section titled “Merge cells”Home ▸ Alignment ▸ Merge & Center, with Merge Across, Merge Cells and Unmerge in its dropdown.
controller.MergeCells(MergeMode.MergeAndCenter); // MergeAcross, MergeCellscontroller.UnmergeCells();Merged ranges follow inserted and deleted rows and columns, like every other reference in the sheet.
Freeze panes
Section titled “Freeze panes”View ▸ Window ▸ Freeze Panes — the selection, the top row, or the first column.
controller.FreezePanes();controller.FreezeTopRow();controller.FreezeFirstColumn();controller.UnfreezePanes();Conditional formatting
Section titled “Conditional formatting”Home ▸ Styles ▸ Conditional Formatting: highlight-cell rules, top/bottom, above/below average, duplicates, data bars and colour
scales. The rules are real conditionalFormatting elements, so Excel evaluates them too.
controller.AddConditionalFormat(ConditionalFormatRule.CellIs(ConditionalOperator.GreaterThan, DxfFormat.LightRedFill, "100"));controller.AddConditionalFormat(ConditionalFormatRule.TopBottom(10, percent: false, bottom: false, DxfFormat.GreenFill));controller.AddConditionalFormat(ConditionalFormatRule.Bar(ConditionalPresets.DataBars[0].Color));controller.AddConditionalFormat(ConditionalPresets.ColorScales[0].Rule);controller.ClearConditionalFormats(entireSheet: false);Cell styles and Format as Table
Section titled “Cell styles and Format as Table”Home ▸ Styles ▸ Cell Styles applies Good / Bad / Neutral, headings, totals and the rest. Format as Table writes a real table part with banded rows and filter arrows.
controller.ApplyCellStyle(CellStylePresets.Find("Good")!);controller.FormatAsTable("TableStyleMedium2");A table’s header cells are its column names — Excel refuses a file where they differ or repeat — so
blank or duplicate headers become Column1, Column2… in the same step. The 60 built-in table styles
are not in the file; the painter derives each from its family (Light / Medium / Dark) and accent, close
enough to read as the style chosen.
Cell Styles apply the style’s formatting directly rather than as a named cellStyles entry, so the
cell looks right in Excel but does not remember it was “Good”.
Format Cells
Section titled “Format Cells”Ctrl+1, Home ▸ Cells ▸ Format ▸ Format Cells…, or the right-click menu. Like every spreadsheet dialog it is a
SheetDialog defined once in the kernel and drawn by one generic renderer per host, so the two hosts
cannot disagree about what a field means.
Home ▸ Cells ▸ Format also carries row height, column width and hide/unhide, and Home ▸ Cells has
Insert and Delete for rows and columns. Inserting and deleting rewrites references across
formulas, defined names, merged cells, conditional formatting, data validation, hyperlinks, notes, the
AutoFilter, tables and charts; a formula that pointed into a deleted band becomes #REF!, as in Excel,
and undo puts both back.


