This page assumes unvell.ReoGrid.One.Avalonia is already installed (Installation).
It is the only GUI package that runs on Windows, Linux and macOS.
Dependencies
This is the only package that references Avalonia (11.3.17). The control has to bind
to the same Avalonia as the consuming app, so unlike the other three packages it cannot
be dependency-free. Make sure your app uses a matching Avalonia version.
Placing the control in XAML
The control lives in the unvell.ReoGrid.Avalonia namespace; the assembly is unvell.ReoGrid.One.Avalonia.
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:rg="clr-namespace:unvell.ReoGrid.Avalonia;assembly=unvell.ReoGrid.One.Avalonia"
x:Class="MyApp.MainWindow"
Title="ReoGrid One" Width="900" Height="600">
<rg:ReoGridControl x:Name="grid" />
</Window>
After calling InitializeComponent() in the code-behind, set values on grid.ActiveWorksheet.
using unvell.ReoGrid.Core;
using unvell.ReoGrid.Core.Style;
var sheet = grid.ActiveWorksheet;
sheet.SetText(0, 0, "商品");
sheet.SetNumber(1, 1, 320);
sheet.SetFormula(2, 1, "SUM(B2:B2)");
sheet.SetRowStyle(0, new StyleRecord { Bold = true, BackgroundColor = 0xFFEFEFEF });
The target framework in .csproj is net10.0 (no -windows suffix).
Differences from the WinForms / WPF editions
The control derives from Avalonia.Controls.Control, and its public members are aligned
with the other platforms.
| Operation | Members |
|---|---|
| Workbook / active sheet | Workbook, ActiveWorksheet, SetWorksheet(ws) |
| Selection | Selection, ActiveCell, SelectionChanged |
| Zoom | Zoom, ZoomChanged |
| Freeze panes | SetFreeze(rows, cols) |
| Loading | LoadWorkbook(wb), NewWorkbook(), LoadJson(json) |
| Formatting the selection | MutateSelectionStyle(...), SetSelectionCellType(...) |
About fonts
On Linux, Japanese text may not be displayed if no Japanese font is installed. For PDF output, a Japanese font (IPAexGothic) is embedded in the DLL, so the PDF output does not depend on the system font configuration (PDF export).
Read next
- Applying a license key
- Running headless — for running screenless processing on a server