Delimiter

CsvDataLoadOptions.Delimiter property

获取或设置用作列分隔符的字符。

public char Delimiter { get; set; }

评论

默认值为“,” (逗号)。

例子

展示如何使用 CSV 作为数据源(字符串)。

Document doc = new Document(MyDir + "Reporting engine template - CSV data destination.docx");

CsvDataLoadOptions loadOptions = new CsvDataLoadOptions(true);
loadOptions.Delimiter = ';';
loadOptions.CommentChar = '$';
loadOptions.HasHeaders = true;
loadOptions.QuoteChar = '"';

CsvDataSource dataSource = new CsvDataSource(MyDir + "List of people.csv", loadOptions);
BuildReport(doc, dataSource, "persons");

doc.Save(ArtifactsDir + "ReportingEngine.CsvDataString.docx");

也可以看看