poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Hoffer <dhoff...@gmail.com>
Subject Re: 3.5-FINAL causes corrupt cells after shiftRows()
Date Sat, 31 Oct 2009 14:04:19 GMT
I have more info on this issue.

What is happening is that in the row that has the 'missing cells' the
old/previous row had an alignment of 'Merge cells' for columns A, B, C & D.

Before I called shiftRows() I called sheet.removeRow(hssfRow).  I did this
at first because I thought it would delete the row and therefore move the
desired data up.  Once I found that it just deleted the contents of the rows
I left it there but then I call shiftRows() to move the rows up.

However after calling both of these methods the original row(s) still have
their old/prior alignment/formatting.

In Excel when you delete and/or move rows you don't get this mixed
behavior.  How can I get the desired behavior of cleaning removing all of
the old and moving the new rows?

Perhaps I'm doing something wrong but this seems like a bug in POI.  I need
a workaround for today.

Thanks much!

On Sat, Oct 31, 2009 at 7:40 AM, David Hoffer <dhoffer6@gmail.com> wrote:

> I have a new application using POI version 3.5-FINAL and I am seeing what
> appears to be a bug in POI.
> Everything is fine until I call shiftRows() on a sheet.  I.e.
> sheet.shiftRows(firstRow.getRowIndex(),
>                 lastRow.getRowIndex(),
>                 3 - firstRow.getRowIndex(),
>                 true,
>                 true);
> The problem is that after this call some of the cells in the row(s) are
> missing their data.  The cells had data before the move and now some are
> just plan empty!
> What I am doing here is moving a set of rows up by a few rows. (And I have
> previously cleared the rows I am moving into...perhaps I did not need to.)
> I immediately save the workbook after this, e.g.
> workbook.write(new FileOutputStream(tempFile));
> Is this a known issue?  How can I fix this?
> Just let me know if you need to see examples of the error.  In my case some
> cells in columns B & C are erased.
> Thanks!

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message