Stringgrid removes quotes lazarus / 31-LCL ---------------------------------------------------------------------- Snus · 2018-01-31 12:04 Hello. When I paste text in double quotes to stringgrid quotes are automatically removed. How to avoid it? (Since upgrade to Lazarus 1.8.0) ---------------------------------------------------------------------- Bart · 2018-01-31 12:39 I cannot reproduce that in current trunk. If I paste "test" into a cell, the quotes are preserved. Just in case you mean "" by double quotes: ""test"" also pastes as expected. My stringrid options are default + goEdit. Please be more precise: what is it exactly that you do? On what OS/Widgetset are you? Can you attach a sample application that reproduces the issue? Bart ---------------------------------------------------------------------- Snus · 2018-01-31 12:56 Sure. https://drive.google.com/file/d/14syWeg- lp_u7vXzmN479fK6aSKWae_Qe/view?usp=sharing Do not open cell editor with double click. Single click to select cell Win8, LCL all default. lazarus x32 ---------------------------------------------------------------------- Bart · 2018-01-31 17:08 First of all, do not include the actual executable in the archive, second please attach the zipped sources to your post in this forum, it's so much easier. Also .rar cannot be opened on Windows without external applications, please use .zip. I built and ran you project, and it works as expected. See attached screenshot. Bart ---------------------------------------------------------------------- Thaddy · 2018-01-31 17:24 Quote from: Bart on January 31, 2018, 06:08:31 pm .rar cannot be opened on Windows without external applications, please use .zip. rar is also hard to open on Linux without extra software. Don't use it. There is no reason for it. And it is proprietary software. And the compression is '80's like. ---------------------------------------------------------------------- balazsszekely · 2018-01-31 17:40 I can reproduce the issue and in my opinion is a bug. If you click once to a cell a red "focused rectangle" appears(image1) and the paste doesn't work correctly. If you click again or doubleclick (image2) the StringGrid goes into edit mode and the text is pasted correctly.  One solution is to add goAlwaysShowEditor to Options: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i StringGrid1.Options := StringGrid1.Options + [goEditing, goAlwaysShowEditor]; ---------------------------------------------------------------------- Bart · 2018-01-31 18:13 I see. The stringgrid does not have goEdit in Options, it should not be writeable at all. Anyhow, when you do not have the editor open, pasting assumes you paste multiple cells, and treats the text on the clipboard as a CSV stream. Processing the text as CSV removes the quote chars. Please file a bugreport. Bart ---------------------------------------------------------------------- Snus · 2018-02-01 09:10 >and treats the text on the clipboard as a CSV stream Well. It is definitely a bug. Why it doesn't copy to csv format than? Here is a copy-paste from one row to another >Please file a bugreport. ok ---------------------------------------------------------------------- wp · 2018-02-01 12:36 I think cells which contain tabs, linebreaks or quotes must be quoted when copying to the clipboard: tab is the column separator, linebreak the row separator, and quotation marks are the quoting identifiers. The current grid code does not take care of the quote case. Open grids.pas, find procedure TCustomStringGrid.CopyCellRectToClipboard and add the condition pos('"', s) > 0 to the local function QuoteText. The entire function should read now like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   function QuoteText(s: string): string;  begin    DoCellProcess(aCol, aRow, cpCopy, s);    if (pos(#9, s)>0) or       (pos(#10, s)>0) or       (pos(#13, s)>0) or       (pos('"', s)>0)                   // <--- NEW    then      result := AnsiQuotedStr(s, '"')    else      result := s;  end; With this modifcation, copy & and paste within the grid and also to and from Excel works correctly for me, also for these rare cases for which a cell contains tabs, lineendings, and quotes. ---------------------------------------------------------------------- Bart · 2018-02-01 14:47 The problem is also in the method that does the copying. It has a parameter TheText, which has the fully quotet text in it. Nevertheless it always strips quotes upon pastes. Bart PS. Better continue the discussion in the bugtracker. ---------------------------------------------------------------------- Snus · 2018-02-02 15:45 https://bugs.freepascal.org/view.php?id=33111