Use InvariantCulture instead of replacing ',' with '.'
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
using Elwig.Helpers;
|
using Elwig.Helpers;
|
||||||
using Elwig.Models.Entities;
|
using Elwig.Models.Entities;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace Elwig.Documents {
|
namespace Elwig.Documents {
|
||||||
@ -36,7 +37,7 @@ namespace Elwig.Documents {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static string GetColGroup(IEnumerable<double> cols) {
|
private static string GetColGroup(IEnumerable<double> cols) {
|
||||||
return "<colgroup>\n" + string.Join("\n", cols.Select(g => $"<col style=\"width: {g.ToString().Replace(',', '.')}mm;\"/>")) + "\n</colgroup>\n";
|
return "<colgroup>\n" + string.Join("\n", cols.Select(g => $"<col style=\"width: {g.ToString(CultureInfo.InvariantCulture)}mm;\"/>")) + "\n</colgroup>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string PrintSortenaufteilung(Dictionary<string, MemberBucket> buckets) {
|
public static string PrintSortenaufteilung(Dictionary<string, MemberBucket> buckets) {
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder;
|
using System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder;
|
||||||
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -264,7 +265,7 @@ namespace Elwig.Helpers.Export {
|
|||||||
} else if (data is float || data is double || data is byte || data is char ||
|
} else if (data is float || data is double || data is byte || data is char ||
|
||||||
data is short || data is ushort || data is int || data is uint || data is long || data is ulong) {
|
data is short || data is ushort || data is int || data is uint || data is long || data is ulong) {
|
||||||
|
|
||||||
double v = double.Parse(data?.ToString() ?? "0");
|
double v = double.Parse(data?.ToString() ?? "0", CultureInfo.InvariantCulture);
|
||||||
if (units != null && units.Length > 0) {
|
if (units != null && units.Length > 0) {
|
||||||
int n = -1;
|
int n = -1;
|
||||||
switch (units[0]) {
|
switch (units[0]) {
|
||||||
@ -274,7 +275,7 @@ namespace Elwig.Helpers.Export {
|
|||||||
}
|
}
|
||||||
if (n >= 0) add = string.Join(" ", add.Split(" ").Select(p => p.StartsWith("table:style-name=") ? $"table:style-name=\"N{n}\"" : p));
|
if (n >= 0) add = string.Join(" ", add.Split(" ").Select(p => p.StartsWith("table:style-name=") ? $"table:style-name=\"N{n}\"" : p));
|
||||||
}
|
}
|
||||||
c = $"<{ct} office:value-type=\"float\" calcext:value-type=\"float\" office:value=\"{v.ToString()?.Replace(",", ".")}\"{add}><text:p>{data}</text:p></{ct}>";
|
c = $"<{ct} office:value-type=\"float\" calcext:value-type=\"float\" office:value=\"{v.ToString(CultureInfo.InvariantCulture)}\"{add}><text:p>{data}</text:p></{ct}>";
|
||||||
} else {
|
} else {
|
||||||
c = $"<{ct} office:value-type=\"string\" calcext:value-type=\"string\"{add}><text:p>{data}</text:p></{ct}>";
|
c = $"<{ct} office:value-type=\"string\" calcext:value-type=\"string\"{add}><text:p>{data}</text:p></{ct}>";
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ using Microsoft.EntityFrameworkCore.ChangeTracking;
|
|||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
@ -391,8 +392,8 @@ namespace Elwig.Windows {
|
|||||||
if (e.Length == 1) filter.RemoveAt(i--);
|
if (e.Length == 1) filter.RemoveAt(i--);
|
||||||
} else if (e.Length > 1 && Utils.FromToRegex.IsMatch(e)) {
|
} else if (e.Length > 1 && Utils.FromToRegex.IsMatch(e)) {
|
||||||
var parts = e.Split("-");
|
var parts = e.Split("-");
|
||||||
double? from = (parts[0].Length > 0) ? double.Parse(parts[0].Replace(".", ",")) : null;
|
double? from = (parts[0].Length > 0) ? double.Parse(parts[0], CultureInfo.InvariantCulture) : null;
|
||||||
double? to = (parts[1].Length > 0) ? double.Parse(parts[1].Replace(".", ",")) : null;
|
double? to = (parts[1].Length > 0) ? double.Parse(parts[1], CultureInfo.InvariantCulture) : null;
|
||||||
switch ((from, to)) {
|
switch ((from, to)) {
|
||||||
case ( <= 30, <= 30):
|
case ( <= 30, <= 30):
|
||||||
case ( <= 30, null):
|
case ( <= 30, null):
|
||||||
|
Reference in New Issue
Block a user