CompuMaster.Excel.OpenXml 2026.11.26

There is a newer version of this package available.
See the version list below for details.
dotnet add package CompuMaster.Excel.OpenXml --version 2026.11.26
                    
NuGet\Install-Package CompuMaster.Excel.OpenXml -Version 2026.11.26
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CompuMaster.Excel.OpenXml" Version="2026.11.26" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CompuMaster.Excel.OpenXml" Version="2026.11.26" />
                    
Directory.Packages.props
<PackageReference Include="CompuMaster.Excel.OpenXml" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CompuMaster.Excel.OpenXml --version 2026.11.26
                    
#r "nuget: CompuMaster.Excel.OpenXml, 2026.11.26"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CompuMaster.Excel.OpenXml@2026.11.26
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CompuMaster.Excel.OpenXml&version=2026.11.26
                    
Install as a Cake Addin
#tool nuget:?package=CompuMaster.Excel.OpenXml&version=2026.11.26
                    
Install as a Cake Tool

CompuMaster.Excel.OpenXml

Edit Open XML workbooks and templates with the Open XML SDK through the ExcelOps API. The engine runs on .NET Framework 4.8 on Windows and modern .NET on Windows and Linux. It copies the input package and edits the affected worksheet and workbook XML. Embedded images and drawing relationships are preserved without using Excel or a graphics library.

using CompuMaster.Excel.ExcelOps;
using static CompuMaster.Excel.ExcelOps.ExcelDataOperationsBase;

using var workbook = new OpenXmlExcelDataOperations(
    "template.xlsx", OpenMode.OpenExistingFile, new ExcelDataOperationsOptions(ExcelDataOperationsOptions.WriteProtectionMode.ReadOnly));

workbook.WriteCellValue("Inputs", 0, 0, "Example");
workbook.WriteCellValue("Inputs", 0, 1, 12);
workbook.RequestRecalculationOnOpen();
workbook.SaveCopyAs("filled.xlsx", SaveOptionsForDisabledCalculationEngines.NoReset);
  • Open an unencrypted XLSX, XLSM, XLTX or XLTM file from a path, byte array or stream, or create a file with one worksheet. The engine snapshots the input. The caller owns any supplied stream.
  • Read and write strings, booleans, finite numbers and blanks with zero-based cell coordinates. Numeric reads return the stored number and do not interpret number formats as dates or currency. Writing a value replaces the cell's formula or old value and retains its formatting. Ordinary formulas can also be stored for later calculation.
  • LookupLastCell, LookupLastRowIndex and LookupLastColumnIndex read the live used range, including formatting and merged areas. Clearing the last unformatted contents or deleting the last used cells can shrink the range immediately. During RecalculateAll or RecalculateSheet, repeated lookups reuse that worksheet's bounds until the run ends.
  • Inspect sheet visibility, hide and very-hide sheets, unhide sheets, and inspect or configure worksheet protection. Protection levels that preserve the existing cell-lock styles are supported. Removing password-protected sheet protection requires a different engine.
  • The destination extension determines the saved format. XLSX and XLTX output omits the VBA project. XLSM and XLTM output preserves the project unless you call RemoveVbaProject(). Excel 4.0 macro sheets prevent export to a macro-free format.
  • Use SaveCopyAs with a different destination to retain the source path, write protection and in-memory workbook state, including VBA and cached formula values. SaveAs switches the current path to the new file and discards the current VBA project when saving to a macro-free format. Save requires a writable file path.
  • Clone() returns an independent, writable copy without a file path. It includes unsaved edits, VBA and cached formula results without recalculating. ICloneable.Clone() returns the same kind of copy.
  • Cloning, saving and workbook mutations are serialized per workbook or across all workbooks in the same formula session. Use separate clones for independent work on different threads.
  • By default the evaluator is disabled and saving preserves workbook calculation mode and cached formula values. Caches can be stale after input edits. RequestRecalculationOnOpen() requests automatic full recalculation in Excel. The existing save cache options can clear cached formula results in the output. Reading a formula cell without a cached value raises MissingCalculatedCellValueException.
  • Inspect cached formula results without calculating by calling HasMissingCachedFormulaResult. The ResetCellValueFromFormulaCell and ResetCellValueFromFormulaCellInWholeWorkbook methods clear stored results in the open workbook while retaining formula text.
  • Export worksheets and workbooks as HTML tables with merged cells, common number formats, and font, fill, alignment and wrap styles. The export follows the EPPlus 4 CM table conventions. The default uses cached formula results and throws MissingCalculatedCellValueException if an exported formula result is missing. Set MissingFormulaResultText to explicitly render replacement text, including an empty string.
  • Adding or removing individual sheets, direct cell writes inside shared, array or data-table formula ranges, and chart rendering raise NotSupportedException.

Formula calculation

Enable the evaluator by setting ExcelDataOperationsOptions.DisableCalculationEngine to false. Opening a workbook still preserves its caches by default. Set DisableInitialCalculation to false as well to recalculate on open.

With the evaluator enabled, call RecalculateCell, RecalculateSheet or RecalculateAll to refresh results, or use FormulaCalculationMode.CalculateIfMissing for a cell lookup or HTML export. CalculateIfMissing uses an existing result for the requested cell. When it calculates a missing result, it also refreshes any evaluated formula precedents. An explicit calculation attempt with the evaluator disabled raises FeatureDisabledException. On save, pass recalculateWorkbook: false to preserve the current caches without requesting calculation after edits.

The evaluator supports ordinary scalar formulas with numbers, text, booleans, arithmetic, percentages, comparisons, concatenation, and A1 references on the same or another worksheet. SUM, AVERAGE, MIN, MAX and COUNT also accept rectangular A1 ranges. The ABS and IF functions are supported. A scalar IF condition evaluates only the selected branch. With an array condition, both branches contribute to the output size and the condition selects a value for each cell. ROW and COLUMN return the first row or column of a reference in scalar formulas, or the formula cell's position when called without arguments. ROWS and COLUMNS return the dimensions of a reference. These functions can reference the formula cell without reading its value. Formula results are stored as numeric, text, Boolean or Excel error values in the XLSX file.

Use English function names, periods in decimal literals and commas between arguments, for example SUM(1.5,2). Arithmetic treats blanks as zero and converts booleans to 1 or 0. Text conversion and numeric text use invariant culture by default. Set FormulaCulture to use a specific culture, including German decimal separators and Boolean text. Text comparisons ignore case. Aggregates coerce Boolean and numeric text arguments passed as values. References contribute their numeric cells. COUNT skips errors, while the other aggregates propagate them.

Additional functions cover rounding and arithmetic (ROUND, ROUNDUP, ROUNDDOWN, TRUNC, INT, MOD, SIGN, SQRT, POWER, PRODUCT). Exponential, logarithmic, circular and hyperbolic functions accept scalar and array arguments. Circular functions follow Excel's argument limit and argument reduction near poles. The bit functions enforce Excel's 48-bit operand range. DELTA and GESTEP compare numbers using an optional zero threshold. ENCODEURL percent-encodes UTF-8 text using the Windows Excel character set and result length limit. BASE and DECIMAL convert values for bases 2 through 36. The engineering conversions between binary, octal, decimal and hexadecimal use Excel's signed widths and optional zero padding. ROMAN supports all five forms, and ARABIC converts classical and abbreviated Roman numerals. COMPLEX and the IM functions use the formula culture to read and display complex numbers with an i or j suffix. The evaluator also supports their exponential, logarithmic, power, circular and hyperbolic functions. FV, PV, PMT, NPER and ISPMT support constant-rate cash flows, including the Excel calculation rules for very small rates. IPMT, PPMT, CUMIPMT and CUMPRINC calculate interest and principal for individual payments or a range of payments. NPV, IRR and MIRR calculate discounted cash flows and rates of return for periodic payments. XNPV and XIRR use the actual payment dates and a 365-day year. RRI, PDURATION and FVSCHEDULE model compound growth. SLN, SYD, DB and DDB calculate depreciation. EFFECT and NOMINAL convert nominal and effective interest rates, and DOLLARDE and DOLLARFR convert fractional dollar values. DISC, INTRATE, RECEIVED, PRICEDISC, YIELDDISC, TBILLEQ, TBILLPRICE and TBILLYIELD calculate prices, returns and yields for discounted securities in the workbook's 1900 or 1904 date system. RATE estimates an annuity rate from a supplied starting value. For a cash flow with a root only at -100%, RATE returns #NUM!. Excel can return an estimate close to -100% for these inputs. CEILING, FLOOR, their modern variants, MROUND, EVEN, ODD and QUOTIENT support scalar and array arguments. Combinatorial functions include factorials, combinations, permutations and MULTINOMIAL. GCD, LCM and SUMSQ accept values and ranges. SERIESSUM evaluates a power series, and SUMXMY2, SUMX2MY2 and SUMX2PY2 calculate sums from paired numeric values. The normal and lognormal distribution functions calculate probabilities, densities and inverse quantiles. The evaluator also supports STANDARDIZE, CONFIDENCE.NORM, PHI, GAUSS and the engineering error integral functions. The gamma, chi-square, exponential and Weibull functions support probability, density and quantile calculations where defined by Excel. For very large degrees of freedom, CHISQ.INV, CHISQ.INV.RT and CHIINV can differ from Excel's iterative search. For example, Excel returns #NUM! for CHISQ.INV(0.95,10000000000) while Open XML returns the estimated quantile.

The beta, Student t and F functions support probability, density and inverse quantiles, including their legacy aliases. CONFIDENCE.T uses a two-tailed Student t quantile. Inverse t and F results can differ from Excel in their least significant digits, especially at very large degrees of freedom. The binomial, negative binomial, hypergeometric and Poisson functions support discrete probabilities and cumulative probabilities. BINOM.DIST.RANGE accepts an inclusive success range, and BINOM.INV and CRITBINOM use the smallest count that meets the probability threshold. Excel can select the next count at some exact thresholds, such as BINOM.INV(1,0.5,0.5).

ADDRESS and INDIRECT support A1 and English R1C1 or German Z1S1 addressing. INDIRECT resolves cell references in the current workbook and in workbooks open in the same formula session. It also resolves named ranges in the current workbook. OFFSET resolves a range relative to its input reference. Both functions are volatile. CHOOSE preserves a selected scalar reference and broadcasts array choices. AREAS, SHEET, SHEETS, ISFORMULA and FORMULATEXT query reference and formula metadata. FORMULATEXT localizes German function names, separators, Boolean literals and common error constants. The function names come from the Microsoft Excel build used for the reference fixtures. TOCOL and TOROW flatten arrays in either direction and can omit blanks and errors. WRAPCOLS, WRAPROWS and EXPAND accept scalar padding. TRIMRANGE removes empty outer rows and columns and preserves the remaining reference. LOOKUP calculates approximate matches in its vector and array forms, and PERCENTOF divides the sums of two inputs.

The paired statistical functions share a numeric-pair calculation for correlation, covariance, slope, intercept, linear forecasts and their error statistics. Other statistical functions include GEOMEAN, HARMEAN, SKEW, SKEW.P, KURT, TRIMMEAN, FISHER and FISHERINV. The hypothesis tests CHISQ.TEST, F.TEST, T.TEST and Z.TEST also support their legacy names. T.TEST handles paired samples, pooled variance and unequal variance. Text positions in LEN, MID, FIND, SEARCH and REPLACE honor the workbook's Excel compatibility version. FIND is case-sensitive and SEARCH accepts Excel wildcards. Text conversion includes VALUE, NUMBERVALUE, CHAR, CODE, UNICHAR, UNICODE, CLEAN and PROPER. CHAR and CODE use the configured formula culture's Windows code page. Text functions also include TRIM, UPPER, LOWER, LEN, LEFT, RIGHT, MID and CONCATENATE. Other functions cover logical and type checks (IFERROR, IFNA, NOT, AND, OR, XOR, TRUE, FALSE, ISBLANK, ISNUMBER, ISTEXT, ISLOGICAL, ISERROR, ISNA, NA, COUNTA, COUNTBLANK), and date and time components (DATE, TIME, YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, TODAY, NOW). Date functions use the workbook's 1900 or 1904 date system. DAYS, EDATE, EOMONTH, WEEKDAY, WEEKNUM and ISOWEEKNUM cover day differences, month offsets, and calendar or ISO week numbering. The evaluator reproduces the separate Excel rules for numeric and text month offsets in the 1904 date system. WORKDAY and NETWORKDAYS support holiday ranges and arrays. Their .INTL variants accept Excel's numeric weekend codes and Monday-first masks. DATEVALUE and TIMEVALUE parse numeric and named-month dates and times in the configured formula culture. A date text without a year uses the calculation's local clock. DATEDIF supports all six interval units. DAYS360 supports the US and European conventions. YEARFRAC implements all five day-count bases, including Excel's different handling of numeric and text arguments in the 1904 date system. FormulaLocalClock optionally supplies local time for deterministic calculation. A pass samples it once when a time-dependent formula needs it.

An unsupported formula raises FormulaComplexityNotSupportedException. With iteration disabled, a direct or indirect dependency on a formula's own calculated value raises CircularReferenceException. In either case, the calculation preserves the original caches. With workbook iteration enabled, numeric self-references and stable circular dependencies start from the current cache or zero and honor Excel's iteration count and maximum change. The evaluator visits open workbooks in name order, refreshes circular cells by worksheet name and cell position, and then evaluates that workbook's dependents before moving to the next workbook. A cycle across workbooks requires all its workbooks to be open in the same formula session with matching iteration settings. The stopping test includes dependent formulas evaluated in the same operation. Cycles with changing dependency membership are outside the supported scope. Shared, grouped array and data-table formulas, relative or external defined names, structured references and VBA execution are outside the supported scope. Full-column references and implicit intersection are outside the supported scope. The evaluator limits expressions to 512 tokens and dependency chains to 256 formulas. It also limits nested expression evaluation.

Workbook names and worksheet-local names support constants and formulas with absolute cell references. MEDIAN, SMALL, LARGE, the RANK variants, and the inclusive and exclusive percentile and quartile functions evaluate ordered numeric data. SMALL, LARGE, rank, percentile and quartile parameters accept arrays. The evaluator also calculates modes, deviations, sample and population variance and standard deviation, and the text- and Boolean-aware summary functions. PERCENTRANK, PERCENTRANK.INC and PERCENTRANK.EXC interpolate between data points and truncate the result to the requested decimal precision. MODE.MULT spills tied results in their first-occurrence order. IFS and SWITCH select scalar or array results and broadcast the participating arguments. ISERR, ISNONTEXT, ISEVEN, ISODD, N, T, TYPE and ERROR.TYPE inspect or convert Excel value types. LET assigns formula-local names to scalars, references or intermediate arrays. Each binding is calculated once when used. COUNTIF, COUNTIFS, SUMIF, SUMIFS, AVERAGEIF, AVERAGEIFS, MINIFS and MAXIFS support comparison criteria and Excel wildcards. SUMPRODUCT multiplies corresponding numeric elements of equally sized ranges or arrays. MDETERM, MINVERSE, MMULT and MUNIT calculate determinants, inverses, matrix products and identity matrices. INDEX, MATCH, VLOOKUP, HLOOKUP and XLOOKUP cover lookup and reference selection. VLOOKUP and HLOOKUP accept tables supplied as ranges or arrays and support array lookup values, result indexes and match options. Use sorted inputs for legacy approximate lookups and modern binary searches. XLOOKUP and XMATCH support forward, reverse and binary search for exact or approximate matches. Wildcards use linear search. XLOOKUP can return a row or a column of results for use inside another formula. Match mode 3 uses PCRE2 with case-sensitive Unicode matching by default, Excel text coercion, and forward or reverse linear search. Regex matching requires a platform supported by PCRE.NET and is subject to matching resource limits. REGEXTEST, REGEXEXTRACT and REGEXREPLACE use the same engine. Extraction supports first matches, all matches, and capture groups. Replacement accepts negative occurrences to count from the end. These functions accept scalar or array arguments. TEXTBEFORE, TEXTAFTER and TEXTSPLIT accept multiple literal delimiters and support case-sensitive or case-insensitive matching. TEXTSPLIT spills rows and columns with optional padding. CONCAT and TEXTJOIN accept ranges and intermediate arrays. TEXTJOIN supports cycling through delimiter arrays and skipping empty text. EXACT, REPT, SUBSTITUTE and REPLACE support scalar arguments. SORT, SORTBY and UNIQUE support intermediate arrays, row and column modes, and typed values. Sorting keeps original order among equal keys. Text sorting uses the configured formula culture.

Rectangular array constants can contain numbers, text, logical values and Excel errors. SEQUENCE, TRANSPOSE, FILTER, TAKE, DROP, CHOOSEROWS, CHOOSECOLS, HSTACK and VSTACK can produce intermediate arrays inside scalar formulas such as SUM(FILTER(B2:B10,A2:A10>0)). INDEX, ROWS, COLUMNS and numeric aggregates can consume these arrays. The evaluator recalculates existing Excel dynamic-array anchors and resizes their worksheet output as needed. It supports Excel's stored _xlfn.ANCHORARRAY references, including references to another sheet. A blocked result is saved as #SPILL!, and clearing the anchor's calculation cache also clears its generated values. Automatic calculation in a session with dynamic anchors refreshes the participating automatic workbooks so changes to spill dimensions reach dependent cells. Use WriteDynamicArrayFormula to create a worksheet anchor in an empty or existing workbook or to replace an existing dynamic array at its anchor. Pass True to calculate and store its output immediately, or False to defer calculation. This method supports invariant Excel formula names and writes the metadata Excel needs to recalculate the spill. Evaluating legacy array formulas and resolving spill-range operators across workbooks are outside the current calculation scope.

Automatic calculation after value edits

Set CalculateOnCellEdit = true and enable the calculation engine to opt in to recalculating after WriteCellValue. The workbook's automatic calculation setting controls when this happens. In manual mode, value edits retain the previous formula caches until a recalculation is requested. The existing formula-write argument still controls whether a formula write calculates immediately.

The first automatic pass builds dependencies by evaluating the workbook. Later value edits recalculate the affected formulas and the dependents of volatile functions. This includes registered open workbooks in the same formula session. Workbooks can also participate in an OpenXmlWorkbookSession for structural reference updates. After a structural change, the next automatic pass rebuilds the calculation dependencies. The dependency graph records value reads through custom function contexts and linked ranges, including cells that were empty. If recalculation fails, the input write remains applied, the previous formula caches remain intact, and the next edit retries the pending work.

Application-defined functions

Create an ExcelFormulaSession, explicitly register each .NET function, and set the session on the workbook's ExcelDataOperationsOptions.FormulaSession. Path-backed workbooks default to the file name as their session name. Set FormulaWorkbookName for a workbook opened from bytes or a stream, or to give a path-backed workbook an alias. Closing the workbook removes it from the session. A recalculating SaveCopyAs uses the session's registered functions and open workbook inputs. The new caches are written to the copy.

A registered function receives typed scalar arguments and an ExcelFormulaContext. The context identifies the workbook, worksheet and formula cell. The caller can independently supply a selection with SetActiveCell. Headless Open XML has no native Excel application object. Use the context's read-only workbook views during the synchronous invocation to read other cells, including cells in other open workbooks in the same session. Those reads resolve formula precedents before returning. A circular dependency can span workbooks. A failed evaluation preserves existing caches across the session.

Excel worksheet formulas can also read linked XLSX workbooks when the sources are explicitly opened in the same session. Path-backed sources are matched to the stored link target. A relative single-file link can use a matching session name when the source is opened from memory. Calculation reports an unavailable source and preserves existing caches. Opening or calculating a workbook never opens a source file or fetches a remote link.

Registered functions are application code. XLSX stores the formula and its cached result. The caller supplies the registration again when it wants to recalculate. An unregistered function is reported as unsupported. Use the registration overload with isVolatile: true if the result depends on state outside the tracked workbook reads. This API supports scalar inputs and outputs. Excel itself needs a separately installed function provider to recalculate the custom formula.

Structural edits

  • Insert or remove whole rows and columns, shift cell rectangles down, right, up or left, and rename worksheets with updateFormulasAndReferences: true. Structural operations use zero-based coordinates. A request for false raises NotSupportedException.
  • The engine updates A1 cells and ranges, including absolute and mixed addresses, whole-row and whole-column references, and references from other worksheets. During partial cell shifts, Excel adjusts a range when its entire width or height lies in the shifted strip. A deleted reference with no surviving cells becomes #REF!. Formula strings retain their original text.
  • Direct 3-D references to a span of worksheets retain their cell coordinates when one sheet in the span changes. When a sheet at either endpoint is renamed, the reference follows that name.
  • Merged areas move when a shift starts before them, expand when cells are inserted inside them, and shrink when cells are removed. A partial shift that cuts through only part of a merged area removes the merge. Other merged areas retain their positions unless the shift reaches them.
  • Insert rows above an Excel table, within its data, or before its totals row. Full-width downward shifts work as well. The table and its filter range follow the new bounds, and inserted data rows receive their calculated-column formulas. Structured references to those columns retain their text. Shared cell formulas are expanded to individual formulas before rewriting. Excel expands direct references and defined names that cover a complete table data range at its first row or before totals.
  • Whole-column edits before a table move its bounds and filter. Whole-row deletions can remove data rows, including the first data row in a table with a header, when at least one data row survives. Cell formulas follow the edit. Deleting the first data row preserves the calculated-column template. Deleting the totals row by itself turns totals off and clears the totals settings on each column.
  • Deleting exactly the entire data body of a supported table retains the first worksheet row in that body as a blank table insertion row. Cells outside the table keep their contents in that row. The table, filter, formulas, defined names and supported chart references follow the resulting worksheet coordinates. Classic chart caches omit the point from a cleared cell. Supported uncached ChartEx series continue to refer to the blank insertion row.
  • Whole-column edits inside a table adjust its bounds and column definitions, including with hidden headers. References to removed columns become #REF!, while surviving structured references retain their text. Inserted columns use generated names with the prefix Spalte for German UI culture and Column otherwise. Filter criteria follow their columns. Deleting the last active criteria unhides the rows of the table body. When a filtered column is deleted, the engine can reapply simple numeric custom filters to unformatted numeric constants.
  • The workbook's R1C1 display setting is preserved. Excel stores direct R1C1 references as A1 in XLSX, including function arguments. The engine follows direct references in dynamic range endpoints such as INDEX(...):INDEX(...) and A1:INDEX(...). It preserves literal text passed to INDIRECT and updates direct references in expressions such as INDIRECT(ADDRESS(ROW(A1),COLUMN(A1),1,FALSE),FALSE). Excel interprets R1C1 address text using its local reference notation.
  • In lookup and database functions, explicit search, data, criteria and field-cell references follow structural edits. Literal field names and numeric column indexes keep their values.
  • Defined names can use absolute, relative, and mixed A1 references with an explicit sheet or a worksheet-local scope. Whole-row and whole-column edits update absolute coordinates on the changed axis. A partial cell shift updates a mixed range endpoint when both of that endpoint's coordinates are absolute. Relative coordinates retain their offsets from the formula using the name. Renaming updates explicit sheet qualifiers, and indirect references encoded as text retain their original text.
  • Successful edits clear stored formula results across the workbook, including possible indirect dependents, and remove the calculation chain on save. The workbook requests full recalculation on load and retains its calculation mode.
  • Direct references to another workbook, such as '[1]Source Data'!$B$2, retain their external coordinates during a local structural edit. When the linked workbook itself changes, a shared workbook session can update incoming references in attached workbooks.
  • Direct sheet-qualified references in classic charts on worksheets and chart sheets follow structural changes. Supported chart roles include titles, series names, categories, values, and scatter X and Y values. The engine moves cached points with their cells and updates supported chart anchors during whole-row and whole-column edits. In supported column, line and scatter series, removing entire source ranges keeps the series and applies Excel's fallback for the affected chart role.
  • Supported dynamic array anchors retain their spill dimensions when they move. If a cell obstructs the new spill, the saved reference contains the anchor only. The engine updates the A1 operands of Excel's stored _xlfn.ANCHORARRAY calls and clears generated cell values for Excel to recalculate.
  • ChartEx sources stored in workbook-scoped _xlchart names follow worksheet renames and supported shifts. The engine updates the uncached source ranges and supported drawing anchors. When a supported value source is deleted in full, the affected data series is removed. Deleting the last value source retains the empty chart and its drawing anchor.
  • Whole-row and whole-column edits also update the placement of supported embedded charts. A chart set to move and size with cells shrinks or grows with its anchor range. Deleting its entire row or column span removes the chart or reduces it to zero size on the edited axis, depending on the original used range on the other axis. The two fixed-size modes preserve the chart dimensions. For two-cell anchors that require recomputing physical column positions, the engine supports the measured Calibri 11 and Aptos Narrow 11 Normal fonts. Other fonts require AllowKnownStructuralReferenceDifferences to use the same width estimate.
  • Whole-column edits preserve explicit widths and hidden columns. Inserted columns stay visible and inherit a positive explicit width from the column on the left. Inserting at the first column or after a column without an explicit width uses the default width. Column styles, best-fit markers, and outlines are unsupported.
  • Excel refuses to delete a selection made up entirely of hidden columns when a table filter is active on the worksheet. Open XML throws StructuralReferenceCompatibilityException before changing the workbook. Set AllowKnownStructuralReferenceDifferences before constructing the engine to allow supported deletions in this case.
  • The engine validates the workbook before applying a structural edit. Unsupported cases include unregistered or unsupported external links, external 3-D references, unsupported dynamic array metadata, overlapping spills, traditional array and data-table formulas, shifts of cached ChartEx data, deleting a ChartEx value dimension from a data series with several numeric dimensions, pivots, hyperlinks, data validations, conditional formatting, and unknown reference-bearing extensions. In classic charts with multiple series, complete source deletion is limited to supported series in column, line and scatter charts. A shift requires the edited worksheet to have no standalone filters or active sheet protection. Unsupported table edits include removing a header, overlapping another table when clearing a data body, reapplying advanced or formula-dependent filter criteria, removing an entire table width, shifting only part of a table, and editing table bounds with a saved sort state.

Copying or moving sheets between workbooks

  • Use CopySheet, CopySheets, MoveSheet, or MoveSheets with two open Open XML workbooks. An optional targetSheetIndex inserts before the tab at that zero-based position. The index counts worksheets and chart sheets together. Omitting it appends the group in source workbook order. Each SheetTransferResult reports the assigned TargetSheetName and actual TargetSheetIndex in the destination.
  • CopyWorksheetFormulaMode.ExcelCompatible follows worksheet identity. References between sheets in the copied group point to their copies. Explicit references to other source worksheets become workbook links. These require a saved source path or a shared workbook session.
  • CopyWorksheetFormulaMode.PreserveFormulas copies the text of supported cell and chart formulas exactly. Sheet qualifiers and names then resolve in the context of the destination. The copy clears cached formula results and formula-based chart caches so Excel can recalculate them.
  • A move stages both workbooks before applying either change. Direct references in the source to moved sheets become links to the destination. Existing destination links to the moved sheets become local references, including in classic chart sheets. Unused destination links to the source are removed and later link indexes are adjusted. Save both workbooks to persist the move.
  • Excel-compatible transfer copies local defined names and referenced workbook names. Supported definitions include constants, absolute cell and range references, calculated names that depend on workbook-scoped names, and relative or mixed references from local or workbook names to the transferred worksheet that uses them. Workbook names must explicitly qualify those references with the worksheet name. The engine rewrites their definitions and gives a conflicting incoming workbook name worksheet scope in the destination. A source formula explicitly naming a local definition on a moved worksheet is unsupported.
  • Compatible groups can contain worksheets with embedded charts and chart sheets, including supported ChartEx charts. ChartEx sources follow the sheets they refer to. In the cases where Excel clears ChartEx series during a group move, Open XML throws StructuralReferenceCompatibilityException by default. Set AllowKnownStructuralReferenceDifferences before constructing the source engine to move the group and keep its series.
  • ChartEx transfers with cached dimensions, conflicting ChartEx source names in PreserveFormulas mode, Excel table transfers, array and data-table formulas, copying formulas from a workbook with external links, and adapting 3-D references during transfer raise NotSupportedException.

Working with several open workbooks

Create an OpenXmlWorkbookSession and call Attach for each participating workbook. Structural edits also update supported direct links and their cached source coordinates in attached dependents, including links used by defined names, supported tables, classic charts and uncached ChartEx sources. Relative coordinates in a defined name retain their offsets. Moves between two attached workbooks also redirect references in other attached workbooks. Closed or detached workbooks stay outside the operation. Incoming structural updates of cached external defined names remain unsupported.

Copying or moving sheets within a session can create links to unsaved workbooks. The generated temporary name identifies the linked workbook until it is saved. Keep the dependents attached and save them after the linked workbook has a path to persist the resolved link. A previously saved dependent file changes only on its next save. Save and close the workbook instances as usual.

See Excel chart reference behavior for the reference cases for embedded charts and chart sheets.

See Excel worksheet transfer behavior for the native Excel reference tests and session limitations.

The engine is licensed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2026.12.2 0 12/2/2026
2026.12.1.2 53 12/1/2026
2026.12.1.1 62 12/1/2026
2026.12.1 55 12/1/2026
2026.11.30 67 11/30/2026
2026.11.29.1 71 11/29/2026
2026.11.29 68 11/29/2026
2026.11.27 71 11/27/2026
2026.11.26 64 11/26/2026
2026.11.24 69 11/24/2026