[OPEN] [#1858] Problem pasting rows from Excel into a web grid ext.net version v5.2

  1. #1

    [OPEN] [#1858] Problem pasting rows from Excel into a web grid ext.net version v5.2

    We noticed that when copying 2 rows from Excel, an empty third row appears on destination grid. So if that grid already had 5 elements on it, the 3rd record gets erased - but the copy was only for the first two records. This copy/paste worked fine under version 4.8.3. However now we are upgrading the system to v5.2 and we see this odd behavior. We see the same problem in your online demo!

    Can you please let us know how to fix this? This is very important to us, since all our users are pasting data from Excel into the web application.
    Last edited by fabricio.murta; Apr 15, 2021 at 7:01 PM. Reason: Added feature request label to the thread's title
  2. #2
    Hello @Ariel!

    You're probably upgrading from 4.x to 5.3.0, right? That's the latest Ext.NET 5 version.

    Can you share the link to the specific online demo or example where you can reproduce the issue?

    I should be able to reproduce that if I copied the grid to an MS-Excel spreadsheet, then selected a a subset of the pasted data and copy it back to the grid, righ?
    Fabrício Murta
    Developer & Support Expert
  3. #3

    A video that shows the problem described above in your v5.3 samples

  4. #4
    Hello, @Ariel!

    I see, you are copying and pasting from MS-Excel into the Grid Panel > Spreadsheet > Clipboard example in v5 Examples Explorer. If you paste the same text to the v4 equivalent example, the extra blank line is not included.

    We are looking for what's up with this issue and will post back here soon.
    Last edited by fabricio.murta; Apr 15, 2021 at 7:02 PM.
  5. #5
    Hello again, @Ariel!

    I am afraid this is a problem that comes from MS-Excel. It always appends a line break to anything copied from it and there's no way to tell it was an empty cell/row in the last clipboard data's row or not.

    If the copy-paste operation is compared with google sheets, for instance, it does not append a trailing blank line to the last row of clipboard data unless the selection included an actual empty value in the last row. MS-Excel would have two empty rows in the same case.

    This stackoverflow thread suggests the Microsoft Excel behavior to be problematic in other cases: Copy from Excel without Line Break.

    It is clear this behavior was intentionally changed between Ext JS 6 and 7 (Ext.NET 4 and 5), as it used to result in ignored last line (if empty data) in any (or at least most) copy-source other than MS-Excel.

    How Ext JS is designed to handle clipboard data does not allow to tell the application which data is coming from; so in case you fall in the issue of empty last rows not making it to pasted data (when copied from other sources not Excel), it would be necessary to selectively enable or disable any work-arounds for that behavior. It is not possible to tell which application the clipboard data is coming from.

    Well, and speaking about work-arounds, here's how you can get back the behavior from Ext.NET 4:

    Ext.define("OldClipboardBehavior", {
        override: "Ext.grid.plugin.Clipboard",
        putCellData: function (data, format) {
            var me = this;
            return me.callParent([ data.replace(Ext.util.TSV.lastLineBreakRe, ''), format ]);
    Add this override at any <script /> block in the pages (client-side markup) where the "paste-able" grid is used and the previous-version behavior should apply.

    As you stated all your users are copying text from MS-Excel, this should do for you, and it may be arguable how last-empty-lines would be missed when pasted in.

    We have logged a feature request under issue #1858 to add an option to switch between behaviors as a setting for the plug in. Unfortunately I don't see a feasible implementation that would allow Ext.NET to infer whether the data comes from Excel or anything else to decide whether to cleanup the trailing newline or not.

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. [CLOSED] spreadsheet selection model pasted rows detection when pasting
    By Geovision in forum 4.x Legacy Premium Help
    Replies: 1
    Last Post: Jul 29, 2016, 12:21 AM
  2. Replies: 4
    Last Post: Mar 08, 2016, 1:52 PM
  3. [CLOSED] Problem on a published Ext.Net web site
    By RCN in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: May 29, 2014, 8:35 PM
  4. Replies: 0
    Last Post: Oct 01, 2013, 9:00 AM
  5. Pasting data in to a Store from Excel
    By danielg in forum Open Discussions
    Replies: 0
    Last Post: Sep 14, 2009, 3:47 PM

Tags for this Thread

Posting Permissions