In hindsight the
procedure TCustomStringGrid.SaveToCSVStream(AStream: TStream; ADelimiter: Char;
WriteTitles: boolean=true; VisibleColumnsOnly: boolean=false);
should have been
procedure TCustomStringGrid.SaveToCSVStream(AStream: TStream; ADelimiter: Char;
WriteFixedRows: boolean=true; VisibleColumnsOnly: boolean=false);
It would have been clear from the start what it meant.
"WriteTitles" is just a little bit too ambiguous.
Current behaviour as decsribed by TS is undesired IMO and it should be rewritten like in the second code block.
Unfortunately not exporting FixedCols was never considered, and the current function signature does not allow for a "natural" extension like
procedure TCustomStringGrid.SaveToCSVStream(AStream: TStream; ADelimiter: Char;
WriteFixedRows: boolean=true; WriteFixedCols: boolean=true; VisibleColumnsOnly: boolean=false);
since it would change the meaning of
SaveToCSVStream(AStream, ADelimiter, True; True);
A possible solution would be to deprecate the old implementation and implement a new one:
procedure TCustomStringGrid.SaveToCSVStream(AStream: TStream; ADelimiter: Char;
WriteFixedRows: boolean; WriteFixedCols: boolean; VisibleColumnsOnly: boolean=false);
and the implementation of the old one would call
SaveToCSVStream(AStream, ADelimiter, WriteTitles, True, VisibleColumnsOnly)
Bart