Skip to content

Commit

Permalink
Merge pull request #191 from KorzhCom/dev
Browse files Browse the repository at this point in the history
Version 1.5.6 of EasyData.NET
  • Loading branch information
korzh authored Jun 23, 2024
2 parents 37c1693 + 53ef94f commit 90d1047
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 10 deletions.
19 changes: 19 additions & 0 deletions easydata.net/src/EasyData.Core/DataUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,5 +283,24 @@ public static string DateTimeToUserFormat(DateTime dt, DataType dataType)
}
return dt.ToString(format, System.Globalization.DateTimeFormatInfo.CurrentInfo);
}

/// <summary>
/// Returns <c>true</c> if the value passed in the parameter is one of the number types.
/// </summary>
/// <param name="value">The object to investigate.</param>
public static bool IsNumber(object value)
{
return value is byte
|| value is sbyte
|| value is short
|| value is ushort
|| value is int
|| value is uint
|| value is long
|| value is ulong
|| value is float
|| value is double
|| value is decimal;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
Expand All @@ -12,7 +12,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ClosedXML" Version="0.100.3" />
<PackageReference Include="ClosedXML" Version="0.102.2" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Threading.Tasks;

using ClosedXML.Excel;
using DocumentFormat.OpenXml.Spreadsheet;

namespace EasyData.Export
{
Expand Down Expand Up @@ -158,13 +159,18 @@ Task WriteRowAsync(EasyDataRow row, bool isExtraRow = false,

var excelDataType = XLDataType.Text;
if (value != null) {
if (!isExtraRow) {
if (isExtraRow) {
if (!string.IsNullOrEmpty(groupFooterTemplate)) {
var formattedValue = DataFormatUtils.GetFormattedValue(row[i], column.DataType, settings.Culture, dfmt);
value = ExportHelpers.ApplyGroupFooterColumnTemplate(groupFooterTemplate, formattedValue, extraData);
}
else {
excelDataType = DataUtils.IsNumber(value) ? XLDataType.Number : XLDataType.Text;
}
}
else {
excelDataType = MapDataType(column.DataType);
}
else if (!string.IsNullOrEmpty(groupFooterTemplate)) {
var formattedValue = DataFormatUtils.GetFormattedValue(row[i], column.DataType, settings.Culture, dfmt);
value = ExportHelpers.ApplyGroupFooterColumnTemplate(groupFooterTemplate, formattedValue, extraData);
}
}

if (!(value is DBNull)) {
Expand Down
6 changes: 3 additions & 3 deletions easydata.net/version.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"assemblyVersion": "1.5.5.1",
"packageVersion": "1.5.5",
"assetVersion": "01_05_05"
"assemblyVersion": "1.5.6.1",
"packageVersion": "1.5.6",
"assetVersion": "01_05_06"
}

0 comments on commit 90d1047

Please sign in to comment.