Results 1 to 2 of 2
  1. #1
    Invexity is offline Member
    Join Date
    Jun 2014
    Rep Power

    Default ShiftRows & Conserve Data?

    Hi, I need a way to insert new cells and/or rows between pre-existing rows without deleting any of the rows.

    I tried using:

    Java Code:
    	public static void addRow(File f, int amount, int currentRow)
    			throws Exception {
    		FileInputStream file = new FileInputStream(f);
    		XSSFWorkbook workbook = new XSSFWorkbook(file);
    		XSSFSheet sheet = workbook.getSheetAt(0);
    		sheet.shiftRows(currentRow, currentRow + amount, amount, true, true);
    		FileOutputStream out = new FileOutputStream(f);
    But unfortunately it deletes some rows down the line to accommodate the shift. The deleted rows seem to be random they aren't actually directly below the shifted rows or above. They seem to happen inbetween shifted rows if I shift more than one row.

    Thank you in advance for your help.

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Rep Power

    Default Re: ShiftRows & Conserve Data?

    Have you run some tests to see what the edge cases are where it starts to fail?
    Are there any structural elements that exist in the sheets that could be causing the problem (eg regions defined?)?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Replies: 5
    Last Post: 05-23-2014, 11:07 AM
  2. Replies: 1
    Last Post: 04-11-2014, 03:39 AM
  3. Replies: 11
    Last Post: 09-21-2012, 10:33 AM
  4. Replies: 0
    Last Post: 10-31-2008, 03:13 PM
  5. Data Sorting in a .data file using java
    By stutiger99 in forum New To Java
    Replies: 2
    Last Post: 10-08-2008, 03:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts