Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Fraser Greenroyd <[email protected]>
  • Loading branch information
IsakNaslundBh and Fraser Greenroyd authored May 4, 2023
1 parent 945414f commit 513c578
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Excel_Adapter/CRUD/Read/Read.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private List<IBHoMObject> 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());
}
Expand Down
6 changes: 3 additions & 3 deletions Excel_Adapter/Convert/FromExcel/CellContents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -62,15 +62,15 @@ 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))
{
//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;
}
Expand Down

0 comments on commit 513c578

Please sign in to comment.