You've already forked lazarus-ccr
fpspreadsheet: Avoid quoted text when copying a single cell with linebreaks to clipboard.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6070 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1410,6 +1410,7 @@ var
|
|||||||
sel: TsCellRangeArray;
|
sel: TsCellRangeArray;
|
||||||
stream: TStream;
|
stream: TStream;
|
||||||
savedCSVParams: TsCSVParams;
|
savedCSVParams: TsCSVParams;
|
||||||
|
s: String;
|
||||||
|
|
||||||
procedure CopyToClipboard(AStream: TStream; AFileFormat: TsSpreadsheetFormat;
|
procedure CopyToClipboard(AStream: TStream; AFileFormat: TsSpreadsheetFormat;
|
||||||
AClipboardFormat: Integer; AParams: TsStreamParams = []);
|
AClipboardFormat: Integer; AParams: TsStreamParams = []);
|
||||||
@ -1466,9 +1467,21 @@ begin
|
|||||||
CopyToClipboard(stream, sfCSV, cfCSVFormat);
|
CopyToClipboard(stream, sfCSV, cfCSVFormat);
|
||||||
|
|
||||||
// Finally write TEXT format
|
// Finally write TEXT format
|
||||||
CsvParams.Delimiter := #9;
|
if FWorksheet.GetSelectionCount = 1 then begin
|
||||||
CopyToClipboard(stream, sfCSV, CF_TEXT);
|
s := FWorksheet.ReadAsText(FWorksheet.ActiveCellRow, FWorksheet.ActiveCellCol);
|
||||||
CSVParams := savedCSVParams;
|
if s <> '' then begin
|
||||||
|
stream.Write(s[1], Length(s));
|
||||||
|
stream.WriteByte(0);
|
||||||
|
stream.Position := 0;
|
||||||
|
Clipboard.AddFormat(CF_TEXT, stream);
|
||||||
|
(stream as TMemoryStream).Clear;
|
||||||
|
end;
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
CsvParams.Delimiter := #9;
|
||||||
|
CopyToClipboard(stream, sfCSV, CF_TEXT);
|
||||||
|
CSVParams := savedCSVParams;
|
||||||
|
end;
|
||||||
|
|
||||||
// To do: XML format, ods format
|
// To do: XML format, ods format
|
||||||
finally
|
finally
|
||||||
|
Reference in New Issue
Block a user