Zach - Using sheet.shiftRows() to shift the rows up leaves an equal number of empty rows at the end. Those empty rows are in fact what I'd like to get rid of. I've tried deleting them, to no avail - the blanks rows are still there. So unfortunately sheet.shiftRows does not help.
In Excel, the same thing happens. However, you can save the file, and the extra rows disappear. Excel seems to trim unused (i.e. empty, unformatted) rows and columns beyond the end of the actual data when saving the file. See http://support.microsoft.com/?id=244435 for Microsoft's take on the problem. So one approach I could take is to simply open the spreadsheet in Excel, make a trivial modification and save it again. But that retains a manual step in a process I'm trying to automate. Karl-Heinz, thanks for the pointer to the "Phantom Cells" thread. That thread addresses why the width of a row might not be what one would expect (rows are in groups of 16, with the width of all rows in the group being the width of the longest row in the group), but it does not talk about this problem of removing entire rows. Thanks for all the ideas, though! -- bob -----Original Message----- From: Zach Engel [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 17, 2005 10:22 AM To: 'POI Users List' Subject: RE: Shrink spreadsheet after removing rows? I think you should use sheet.shiftRows (int startRow, int endRow, int n) Shift all the rows (under the row you want to remove) up by one Does this help? -----Original Message----- From: Robert Herold [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 17, 2005 8:16 PM To: 'POI Users List' Subject: RE: Shrink spreadsheet after removing rows? (Bump to top of communal conciousness again) Is this possible to do? Maybe it's so obvious that no one bothered to respond to such an idiotic question... Thanks for any help. -- bob -----Original Message----- From: Robert Herold [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 09, 2005 1:38 PM To: [email protected] Subject: Shrink spreadsheet after removing rows? Just started using poi.hssf yesterday - very nice! I'm using it to manipulate an existing spreadsheet. I want to remove a row in the middle, so I move all rows after it up by one. This leaves a blank row at the end, which one can see after writing it out and opening it with Excel. I've tried removing the blank row, to no avail. Is there any way to shrink the spreadsheet to not include the blank row? -- bob --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
