Uploaded image for project: 'Keikai'
  1. Keikai
  2. KEIKAI-318

set multiple cell values at once in a row or a column

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Done
    • Icon: Normal Normal
    • 5.5.0
    • None
    • None
    • None

      Use Case

      When populating data into cells, app developers usually need to set multiple cells with a java bean. The current usage:

      Ranges.range(sheet, START_ROW + index, 2).setCellValue(s.getId());
      Ranges.range(sheet, START_ROW + index, 3).setCellValue(s.getFormName());
      Ranges.range(sheet, START_ROW + index, 4).setCellValue(s.getOwner());
      Ranges.range(sheet, START_ROW + index, 5).setCellValue(s.getState().toString());
      Ranges.range(sheet, START_ROW + index, 6).setCellValue(s.getLastUpdate());
      

      problems

      Duplicate code to create many Range objects

      Proposed Solution

      A helper method can set multiple cells at once can save a developer's effort.

      /** fill specified multiple values cell by cell in one row starting from the left-top corner cell of this Range, then fill the next cell on the right, e.g. A1, B1, C1...
      */
      public void setCellValuesInRow(Object... values){
      }
      
      
      
      /** fill multiple values cell by cell in one column starting from the left-top corner cell of this Range, then fill the next cell on the right, e.g. A1, A2, A3...
      */
      public void setCellValuesInColumn(Object... values){
      }
      
      
      
      • It should treat a merged cell as one cell. For example, setting 3 values (v1, v2, v3) into 3 cells in a row: A1, B1:C1, D1. The method should know B1:C1 is a merged cell and set v3 into D1 instead of C1.

      usages

      range.setCellValuesInRow(s.getId(), s.getFormName(), s.getOwner());
      String [] values;
      // fill values
      range.setCellValuesInColumn(values);
      

            jumperchen jumperchen
            hawk hawk
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: