From 513c57838304e95b9d637b604fa64f49d5f24e98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isak=20N=C3=A4slund?= Date: Thu, 4 May 2023 11:12:24 +0200 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Fraser Greenroyd --- Excel_Adapter/CRUD/Read/Read.cs | 2 +- Excel_Adapter/Convert/FromExcel/CellContents.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Excel_Adapter/CRUD/Read/Read.cs b/Excel_Adapter/CRUD/Read/Read.cs index 1bdd517..169eab9 100644 --- a/Excel_Adapter/CRUD/Read/Read.cs +++ b/Excel_Adapter/CRUD/Read/Read.cs @@ -126,7 +126,7 @@ private List ReadExcel(XLWorkbook workbook, string worksheet, strin foreach (IXLRangeColumn column in ixlRange.Columns()) { if (valuesOnly) - dataRow.Add(ixlWorksheet.Cell(row.RowNumber(), column.ColumnNumber()).CellValueOrCashedValue()); + dataRow.Add(ixlWorksheet.Cell(row.RowNumber(), column.ColumnNumber()).CellValueOrCachedValue()); else dataRow.Add((ixlWorksheet.Cell(row.RowNumber(), column.ColumnNumber())).FromExcel()); } diff --git a/Excel_Adapter/Convert/FromExcel/CellContents.cs b/Excel_Adapter/Convert/FromExcel/CellContents.cs index d8d14c6..45a4dfb 100644 --- a/Excel_Adapter/Convert/FromExcel/CellContents.cs +++ b/Excel_Adapter/Convert/FromExcel/CellContents.cs @@ -45,7 +45,7 @@ public static CellContents FromExcel(this IXLCell xLCell) return new CellContents() { Comment = xLCell.HasComment ? xLCell.Comment.Text : "", - Value = xLCell.CellValueOrCashedValue(), + Value = xLCell.CellValueOrCachedValue(), Address = BH.Engine.Excel.Create.CellAddress(xLCell.Address.ToString()), DataType = xLCell.DataType.SystemType(), FormulaA1 = xLCell.FormulaA1, @@ -62,7 +62,7 @@ public static CellContents FromExcel(this IXLCell xLCell) [Description("Gets the value of the cell, or cached value if the TryGetValue method fails. Raises a warning if the cached value is used, and ClosedXML beleives the cell needs to be recalculated.")] [Input("xLCell", "IXLCell to get the (cached) value from.")] [Input("value", "Value or cached value of the cell.")] - public static object CellValueOrCashedValue(this IXLCell xLCell) + public static object CellValueOrCachedValue(this IXLCell xLCell) { object value; if (!xLCell.TryGetValue(out value)) @@ -70,7 +70,7 @@ public static object CellValueOrCashedValue(this IXLCell xLCell) //If not able to just get the value, then get the cached value //If cell is flagged as needing recalculation, raise warning. if (xLCell.NeedsRecalculation) - BH.Engine.Base.Compute.RecordWarning($"Cell {xLCell?.Address?.ToString() ?? "unknown"} is flagged as needing to be recalculated, but this is not able to be done. The cached value for this cell is returned, which for most cases is correct, but please ensure the validity of the value."); + BH.Engine.Base.Compute.RecordWarning($"Cell {xLCell?.Address?.ToString() ?? "unknown"} is flagged as needing to be recalculated, but this is not able to be done. The cached value for this cell is returned, which for most cases is correct, but please check the validity of the value."); value = xLCell.CachedValue; }