V4 V5

The package is unvell.ReoGrid.One.Avalonia and the namespace is unvell.ReoGrid.Avalonia. It is the only GUI package that runs on Windows, Linux and macOS.

For getting started and sample code, see Avalonia Quick Start.

Dependencies

This package alone carries a PackageReference on Avalonia (11.3.17), because the control has to bind to the same Avalonia as the host application.

The other three packages (One, One.Wpf, One.Core) have no package dependencies at all.

The target framework is net10.0 (no -windows suffix).

Structure

ReoGridControl derives from Avalonia.Controls.Control, and draws through AvaloniaGraphics (built on DrawingContext).

As with WPF, DIP matches the logical pixel, so no DPI conversion is needed.

Members

CategoryMembers
WorkbookWorkbook ActiveWorksheet SetWorksheet LoadWorkbook NewWorkbook LoadJson
SelectionSelection ActiveCell SelectionChanged
EditingBeginEdit CancelEdit IsEditing SetActiveCellInput
DisplayZoom ZoomChanged SetFreeze
FormattingMutateSelectionStyle SetSelectionCellType and more
HistoryUndo Redo CanUndo CanRedo
EventsWorkbookChanged ActiveSheetChanged ContextMenuRequested CellButtonClicked HistoryChanged

RenderTo(context, width, height) renders to any DrawingContext.

using unvell.ReoGrid.Avalonia;
using unvell.ReoGrid.Core;

grid.NewWorkbook();
Worksheet ws = grid.ActiveWorksheet;
ws.SetText(0, 0, "Branch");
ws.SetFormula(1, 3, "B2+C2");

grid.SelectionChanged += (_, _) =>
	Console.WriteLine($"{grid.ActiveCell.Row},{grid.ActiveCell.Col}");

grid.CellButtonClicked += (_, e) =>
	Console.WriteLine($"button pressed: {e.Cell.Row},{e.Cell.Col}");

// history, zoom and freeze live on the control (the same on all three platforms)
grid.SetFreeze(rows: 1, cols: 1);
grid.Zoom = 1.25;
if (grid.CanUndo) grid.Undo();

Differences from the other builds

WinForms / WPFAvalonia
Runs onWindows onlyWindows / Linux / macOS
DependenciesnoneAvalonia
PrintingCreatePrintDocument() (WinForms) / Print() (WPF)not supported (use PDF export)

Printing is the only difference. History, editing, formatting, clipboard and outline APIs are identical across the three platforms.

Printing is absent because Avalonia has no common print API. When you need paper output, use PDF Export. PDF embeds Japanese fonts, so it works on Linux regardless of what fonts are installed.

Fonts

On Linux, text may not appear on screen when no Japanese font is installed. Configure a fallback through Avalonia’s font settings.

PDF export is unaffected (the fonts are embedded in the DLL).

Was this article helpful?