I am trying to write a function that receives a DataTable and writes the data from it into a csv file, The function works, but I want the file content to be displayed in Right-to-Left (RTL)..
I tried adding culture info, utf8 but it didn’t work and I didn’t find any support how can I do it?
that’s my code
private static async Task SaveCsvFile(DataTable dt, FileInfo file)
{
var cultureInfo = new CultureInfo("he-IL");
using var writer = new StreamWriter(file.FullName, false, Encoding.UTF8);
using var csv = new CsvHelper.CsvWriter(writer, cultureInfo);
foreach (DataColumn column in dt.Columns)
{
csv.WriteField(column.ColumnName);
}
await csv.NextRecordAsync();
foreach (DataRow row in dt.Rows)
{
for (int i = 0; i < dt.Columns.Count; i++)
{
csv.WriteField(row[i]);
}
await csv.NextRecordAsync();
}
}