public override object TransformData(IFreeDocument datas) { var item = datas[Column]; if (item == null) { item = ""; } var strs = new List <object> { item }; if (string.IsNullOrEmpty(Format)) { return(item); } var columns = MergeWith.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries); strs.AddRange(columns.Select(key => { if (datas.ContainsKey(key)) { return(datas[key]); } return(key); })); return(string.Format(Format, strs.ToArray())); }
public override object TransformData(IFreeDocument datas) { var item = datas[Column]; if (item == null) { item = ""; } var strs = new List <object> { item }; if (string.IsNullOrEmpty(Format)) { return(item); } var format = datas.Query(Format); var exps = rgx.Matches(format); foreach (Match exp in exps) { format = format.Replace(exp.Value, datas.Query(exp.Value)); } var columns = MergeWith.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries); strs.AddRange(columns.Select(key => { if (datas.ContainsKey(key)) { return(datas[key]); } return(key); })); return(string.Format(format, strs.ToArray())); }
public override IEnumerable <string> InputColumns() { if (!string.IsNullOrEmpty(Column)) { yield return(Column); } if (!string.IsNullOrEmpty(MergeWith)) { foreach (var col in MergeWith.Split(' ')) { yield return(col); } } }
public override object TransformData(IFreeDocument datas) { object item = datas[this.Column]; if (item == null) { item = ""; } List <object> strs = new List <object>(); strs.Add(item); var Columns = MergeWith.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries); strs.AddRange(Columns.Select(Column => datas[Column])); return(string.Format(Format, strs.ToArray())); }