Settings for new line character when saving TExcelFile to CSV

Hi,

I'm using TExcelFile; to export a dataset to CSV.

Is there an option to change the new line character of a CSV file? I've looked into the documentation but missed that one.

Thank you

Hi,
Sadly currently there is no way to change the new line. The new line is defined as :slight_smile:
const
Environment_NewLine = sLineBreak;

sLineBreak which is defined in System.Pas as:

const
sLineBreak = {$IFDEF POSIX} _AnsiStr(#10) {$ENDIF}
{$IFDEF MSWINDOWS} _AnsiStr(#13#10) {$ENDIF};

I think we could make Environment_NewLine a variable and let you select the value. Would this be a good solution?

Hi Adrian,

We're using the TExcelFile with XData. Where a different requests may need a different linebreaks. Will the variable become a setting for the thread (or better TExcelFile object) that created the TExcelFile?

It shuold be a parameter to Export (like the delimiter), but maybe also a global variable for everything. Thread variables have their own load of issues, so I'd rather avoid them when possible.

Hi Adrian,

That is a great solution.