V4 V5

Reading and writing XLSX (OOXML) is handled by unvell.ReoGrid.IO.Excel. It depends on no external packages (neither the Open XML SDK nor EPPlus is used).

Everything is bundled with the One packages.

Reading and writing

using unvell.ReoGrid.Core;
using unvell.ReoGrid.IO.Excel;

Workbook loaded = XlsxReader.Read("book.xlsx");
XlsxWriter.Write(wb, "out.xlsx");

// a stream works too
using var stream = File.OpenRead("book.xlsx");
Workbook fromStream = XlsxReader.Read(stream);

XlsxWriter.Write has a stream overload as well.

Streaming reads

Reading is streamed through XmlReader directly into the sparse store. Memory usage is proportional to the number of cells that actually exist (not the sheet’s declared dimensions).

Lazy loading for huge files

// open a huge file with per-sheet lazy loading
using var virtualBook = XlsxReader.OpenVirtual("large.xlsx", SheetLoadMode.OnDemand);
ModeBehavior
OnDemandBuilds each sheet the first time it is displayed
BackgroundBuilds the active sheet first, then prefetches the rest in the background

VirtualWorkbook is IDisposable. It holds on to the underlying stream, so dispose it when you are done.

How formulas are handled

Formulas are not re-evaluated on load. The cached values saved by Excel are used as-is.

var wb = XlsxReader.Read("book.xlsx");

// The cached values Excel saved are read as-is, so nothing is re-evaluated on load.
// Call this only when you want to compute them yourself.
foreach (var sheet in wb.Worksheets)
	sheet.Recalculate();

There is a reason for this design: even for files containing functions that V5 does not implement, the values Excel calculated are displayed as-is. Re-evaluating them would turn them into #NAME?.

What is supported

FeatureReadWrite
Values (numbers, strings, booleans, dates, errors)YesYes
Shared strings, inline strings, rich stringsYesYes
Styles (font, color, alignment, wrapping)YesYes
Number formatsYesYes
BordersYesYes
Merged cellsYesYes
Row heights, column widths, hidden stateYesYes
1900 / 1904 date systemsYesYes
Conditional formatting (<conditionalFormatting> / <dxfs>)YesYes
Defined names (<definedNames>)YesYes
Outlines (grouping)YesYes
Images (drawing)YesYes
Page setup (<pageSetup>)YesYes
Header/footer (<headerFooter>) and print titlesYesYes
View state (frozen panes, zoom, gridlines), hidden sheets, tab colorsYesYes
Auto filter (<autoFilter>)YesYes
Cell notes (comments{n}.xml plus VML)YesYes
Data validation (<dataValidations>)YesYes
Sheet protection (<sheetProtection>)YesYes
FormulasYes (cached values preserved)Yes

Not supported

FeatureNotes
Shared formula expansion
Charts and shapesImages are supported
Cell typesXLSX has no corresponding concept, so they become plain cells
Threaded commentsOnly the classic note is supported
Alternating row fills (banded rows)Excel keeps them inside a table style
Built-in names (_xlnm.*)Only Print_Area and Print_Titles round-trip, as PrintSettings
Data bar negative colors, zero axis, and bordersRequires the OOXML x14 extensions
Split (unfrozen) panesFrozen panes do round-trip
cellStyleXfs (xfId) style inheritanceNot expanded on read
Was this article helpful?