Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing Error on pull caused by version update of ClosedXML to 0.102 #73

Merged
merged 3 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions Excel_Adapter/AdapterActions/Push.cs
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,9 @@ private static void GetPropertyDictionary(ref Dictionary<string, object> dict, o
}
else if (obj.GetType().IsPrimitive || obj is string || obj is Guid || obj is Enum)
{
if (obj is Guid)
obj = obj.ToString(); // TODO: Temporary fix to cover for a bug in IToText() from the base engine when used on Guids. Remove when fix in the base engine.

string key = parentType.Length > 0 ? parentType : "Value";
dict[key] = obj;
return;
Expand Down
27 changes: 25 additions & 2 deletions Excel_Adapter/Convert/FromExcel/CellContents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static CellContents FromExcel(this IXLCell xLCell)
[Input("value", "Value or cached value of the cell.")]
public static object CellValueOrCachedValue(this IXLCell xLCell)
{
object value;
XLCellValue value;
if (!xLCell.TryGetValue(out value))
{
//If not able to just get the value, then get the cached value
Expand All @@ -74,7 +74,7 @@ public static object CellValueOrCachedValue(this IXLCell xLCell)

value = xLCell.CachedValue;
}
return value;
return ExtractValue(value);
}

/*******************************************/
Expand All @@ -101,6 +101,29 @@ private static Type SystemType(this XLDataType dataType)
}

/*******************************************/

private static object ExtractValue(XLCellValue xCellValue)
{
switch (xCellValue.Type)
{
case XLDataType.Boolean:
return xCellValue.GetBoolean();
case XLDataType.DateTime:
return xCellValue.GetDateTime();
case XLDataType.Number:
return xCellValue.GetNumber();
case XLDataType.Text:
return xCellValue.GetText();
case XLDataType.TimeSpan:
return xCellValue.GetTimeSpan();
case XLDataType.Error:
return null;
default:
return null;
}
}

/*******************************************/
}
}

Expand Down
2 changes: 1 addition & 1 deletion Excel_Adapter/Excel_Adapter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</PropertyGroup>

<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(Configuration)'=='Debug' Or '$(Configuration)'=='Release'">
<Exec Command="xcopy &quot;$(TargetPath)&quot; &quot;$(ProgramData)\BHoM\Assemblies&quot; /C /Y&#xD;&#xA;xcopy &quot;$(TargetDir)ClosedXML.dll&quot; &quot;$(ProgramData)\BHoM\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)ExcelNumberFormat.dll&quot; &quot;$(ProgramData)\BHoM\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)DocumentFormat.OpenXml.dll&quot; &quot;$(ProgramData)\BHoM\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)SixLabors.Fonts.dll&quot; &quot;$(ProgramData)\BHoM\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)System.IO.Packaging.dll&quot; &quot;$(ProgramData)\BHoM\Assemblies&quot; /Y" />
<Exec Command="xcopy &quot;$(TargetPath)&quot; &quot;$(ProgramData)\BHoM\Assemblies&quot; /C /Y&#xD;&#xA;xcopy &quot;$(TargetDir)ClosedXML.dll&quot; &quot;$(ProgramData)\BHoM\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)ExcelNumberFormat.dll&quot; &quot;$(ProgramData)\BHoM\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)DocumentFormat.OpenXml.dll&quot; &quot;$(ProgramData)\BHoM\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)SixLabors.Fonts.dll&quot; &quot;$(ProgramData)\BHoM\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)System.IO.Packaging.dll&quot; &quot;$(ProgramData)\BHoM\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)Irony.dll&quot; &quot;$(ProgramData)\BHoM\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)XLParser.dll&quot; &quot;$(ProgramData)\BHoM\Assemblies&quot; /Y" />
</Target>

<ItemGroup>
Expand Down