From e9f608a23803fa79901968de8d3dc2855021eda9 Mon Sep 17 00:00:00 2001 From: walon Date: Tue, 16 Nov 2021 19:13:21 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BC=98=E5=8C=96=E3=80=91convert=5Fx?= =?UTF-8?q?lsx=E6=A0=BC=E5=BC=8F=EF=BC=8C=E5=AF=B9=E4=BA=8E=E5=A4=8D?= =?UTF-8?q?=E5=90=88=E5=AD=97=E6=AE=B5=EF=BC=8C=E5=A6=82=E6=9E=9C=E6=9C=AA?= =?UTF-8?q?=E6=8C=87=E5=AE=9Asep=EF=BC=8C=E5=88=99=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E4=BD=BF=E7=94=A8|?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DataConverts/ToExcelStringVisitor.cs | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/Luban.Job.Cfg/Source/DataConverts/ToExcelStringVisitor.cs b/src/Luban.Job.Cfg/Source/DataConverts/ToExcelStringVisitor.cs index bf1519d..006dd25 100644 --- a/src/Luban.Job.Cfg/Source/DataConverts/ToExcelStringVisitor.cs +++ b/src/Luban.Job.Cfg/Source/DataConverts/ToExcelStringVisitor.cs @@ -97,6 +97,10 @@ namespace Luban.Job.Cfg.DataConverts { sep = type.Type.Sep; } + else if (string.IsNullOrWhiteSpace(sep)) + { + sep = "|"; + } var sb = new List(); if (type.Type.IsAbstractType) { @@ -133,33 +137,37 @@ namespace Luban.Job.Cfg.DataConverts public string Accept(DArray type, string sep) { - if (string.IsNullOrEmpty(sep) && type.Type.ElementType.Apply(IsNotSepTypeVisitor.Ins)) + if (string.IsNullOrEmpty(sep)) { - sep = ";"; + sep = type.Type.ElementType.Apply(IsNotSepTypeVisitor.Ins) ? ";" : "|"; } return string.Join(sep, type.Datas.Select(d => d.Apply(this, sep))); } public string Accept(DList type, string sep) { - if (string.IsNullOrEmpty(sep) && type.Type.ElementType.Apply(IsNotSepTypeVisitor.Ins)) + if (string.IsNullOrEmpty(sep)) { - sep = ","; + sep = type.Type.ElementType.Apply(IsNotSepTypeVisitor.Ins) ? ";" : "|"; } return string.Join(sep, type.Datas.Select(d => d.Apply(this, sep))); } public string Accept(DSet type, string sep) { - if (string.IsNullOrEmpty(sep) && type.Type.ElementType.Apply(IsNotSepTypeVisitor.Ins)) + if (string.IsNullOrEmpty(sep)) { - sep = ","; + sep = type.Type.ElementType.Apply(IsNotSepTypeVisitor.Ins) ? ";" : "|"; } return string.Join(sep, type.Datas.Select(d => d.Apply(this, sep))); } public string Accept(DMap type, string sep) { + if (string.IsNullOrEmpty(sep)) + { + sep = "|"; + } return string.Join(sep, type.Datas.Select(d => $"{d.Key.Apply(this, sep)}{sep}{d.Value.Apply(this, sep)}")); }