Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions PanoramicData.SheetMagic/MagicSpreadsheet.CellOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,7 @@ private static string GetCellValueString(Cell cell, SharedStringTablePart? strin

if (cell.DataType != null && (CellValues)cell.DataType == CellValues.SharedString)
{
if (stringTable?.SharedStringTable is null || cellValueText == null)
{
return string.Empty;
}
return stringTable.SharedStringTable.ElementAt(int.Parse(cellValueText)).InnerText;
return GetSharedStringValue(stringTable, cellValueText);
}

return cellValueText ?? cell.InnerText;
Expand Down Expand Up @@ -390,10 +386,8 @@ private static string GetSharedStringValue(SharedStringTablePart? stringTable, s

var stringTableIndex = int.Parse(cellValueText);
var sharedStringElement = stringTable.SharedStringTable.ElementAt(stringTableIndex);
var sharedStringValue = sharedStringElement.InnerText;

// Handle special Infinity values for object-typed cells
return TryParseInfinityForObject<T>(sharedStringValue) ?? (object)sharedStringValue;
return TryParseInfinityForObject<T>(sharedStringElement.InnerText) ?? (object)sharedStringElement.InnerText;
}

/// <summary>
Expand All @@ -406,12 +400,7 @@ private static string GetSharedStringValue(SharedStringTablePart? stringTable, s
: null;

private static bool? ParseBooleanValueTyped(string? cellValueText)
=> cellValueText switch
{
"1" or "true" => true,
"0" or "false" => false,
_ => null,
};
=> ParseBooleanValue(cellValueText);

private static double ParseNumberTyped(string? cellValueText)
{
Expand Down
Loading