Migration from 0.101 to 0.102
Array formulas
Setting the property IXLCell.FormulaA1
to a formula with braces (e.g.
{=1+2}
) will cause an exception during formula evaluation. The braces were
previously stripped automatically and formula was evaluated as a normal
formula.
The cell formula isn’t parsed, unless necessary (i.e. formula must be evaluated), so it is still possible to set formula to an invalid value that will later be saved to a file.
Fallback font
DefaultGraphicEngine used to throw an exception, when it was unable to find requested font nor fallback font. It now uses a stripped version of a Carlito font (Calibri metric compatible font), when no font is available.
That means the exception is no longer thrown, but in case of missing fallback font, it uses the embedded font that was stripped down and might cause slightly different widths of columns or other issues.
For more details, see Graphic Engine page.
Cells
The content of the cells is now stored in sparse arrays, instead of directly in
the IXLCell
. That causes several changes:
Each time user receives a IXLCell, it is a newly created proxy to the sparse array.
Object.ReferenceEquals(ws.Cell("A1"), ws.Cell("A1"))
is nowfalse
, used to betrue
.The address of a cell is no longer updated, when areas are deleted or inserted. The cell from
IXLCell cell = worksheet.Cell("A4")
now always returns value at A4, even if row 2 has been deleted above the cell. Previously, when a row above was deleted, thecell
was moved and contained data from A3.
The main consequence is that operator ==
no longer returns true
two
IXLCell
with same address. Use the Equals
method.
var first = ws.Cell("A1");
var second = ws.Cell("A1");
if (first == second) {
// no longer works
}
if (first.Equals(second))
{
// works
}
AddWorksheet table name
The methods IXLWorksheet AddWorksheet(DataTable dataTable)
and
IXLWorksheet AddWorksheet(DataTable dataTable, string sheetName)
add a new worksheet with a table. The name of a table used to be same as name
of inserted sheet. The name of a table is now autogenerated pattern
Table{some number}. The first name name is Table1 and the number increases,
until a unused name if found.
There is a new overload IXLWorksheet AddWorksheet(DataTable dataTable, string sheetName, string tableName)
that can specify the name of a table directly.
var dt = new DataTable("Patients table");
dt.Columns.Add("Patient", typeof(string));
dt.Rows.Add("David");
using var wb = new XLWorkbook();
var ws1 = wb.AddWorksheet(dt);
Console.WriteLine($"{ws1.Name} {ws1.Tables.Single().Name}");
var ws2 = wb.AddWorksheet(dt, "Sheet name");
Console.WriteLine($"{ws2.Name} {ws2.Tables.Single().Name}");
// Output: 0.101
// Patients table Patients table
// Sheet name Sheet name
// Output: 0.102
// Patients table Table1
// Sheet name Table2