* * *

Author Topic: Copy from WorksheetGrid  (Read 257 times)

straetch

  • Jr. Member
  • **
  • Posts: 56
Copy from WorksheetGrid
« on: November 13, 2017, 04:53:15 pm »
In a WorksheetGrid with no editor active (goAlwaysShowEditor = false and goEditing = false) if the user clicks on a cell and copy the cell content (Ctrl-C), then the clipboard contains the text from within the cell, but the last character is missing.
Also in that case, with no changes allowed to the grid, it would be interesting to be able to copy a part of the cell content.

wp

  • Hero Member
  • *****
  • Posts: 3893
Re: Copy from WorksheetGrid
« Reply #1 on: November 13, 2017, 06:34:39 pm »
Please test the current r6069. A trailing zero byte was missing for the CF_TEXT clipboard format; normally fpspreadsheet copies several formats to the clipboard, and the CF_Text format normally is not pasted, but a more complex format. Therefore this bug was not seen before.

I hope this bug won't bite me again, because there is an ongoing discussion about a trailing byte causing trouble in Linux.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

straetch

  • Jr. Member
  • **
  • Posts: 56
Re: Copy from WorksheetGrid
« Reply #2 on: November 14, 2017, 09:36:47 am »
The last character  is no longer missing with r6069. Thanks.
I notice that text in a cell, containing a return character, is put between "" (double quotes) when copied to the clipboard.

wp

  • Hero Member
  • *****
  • Posts: 3893
Re: Copy from WorksheetGrid
« Reply #3 on: November 14, 2017, 12:44:19 pm »
Copying to clipboard as text occurs via a csv stream. Therefore a cell with manual linebreak is quoted (because the linebreak normally would be interpreted as a new row).

In r5070 I added a special treatment for the case of a single cell where the cell text can be copied directly.

Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

straetch

  • Jr. Member
  • **
  • Posts: 56
Re: Copy from WorksheetGrid
« Reply #4 on: November 15, 2017, 04:42:48 pm »
Now it works as expected.
Many thanks.

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus