Uploaded image for project: 'ZK Spreadsheet'
  1. ZK Spreadsheet
  2. ZSS-1207

Only copy to the last row that contains data when copying a column range

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Won't Do
    • Icon: Normal Normal
    • None
    • 3.8.2
    • None
    • Security Level: Jimmy
    • Sprint 4, Sprint 8

      When copying a column range like:

      private String TABLE_RANGE = "A:E";
      Range source = Ranges.range(templateSheet, TABLE_RANGE);
      Range destination = Ranges.range(newSheet, TABLE_AREA);
      source.paste(destination);
      

      ZSS will actually copy A1: E1048576 and cause out of memory exception.

      proposed solution

      Optimize the range to copy before copying.
      only copy the range with the last row that contains data of that column range. For example, in A:E the last row that contains data is 300, then zss turn the range into A1:E300

      debug info

      • copy the whole row also has the similar issue, and it will include the max column, 16384. Then, it takes a very long time.

      workaround

      • skip blank cells
        // current  workaround, skip blank cells
        source.pasteSpecial(destination, PasteType.ALL, PasteOperation.NONE, true, false);
        
      • specify a smaller copying range

            henrichen henrichen
            hawk hawk
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: