You can use Region region = new Region(rowStart, (short)(colStart), rowEnd, (short)(colEnd)); sheet.addMergedRegion(region);
To add a merged region. To check, if a row contains a merged region you propably need to use sheet.getMergedRegionAt(index) and test if your current row is within the region. Hth, Tobias P.S. @Karsten: Hättest auch gleich bei uns anrufen können :-) -----Ursprüngliche Nachricht----- Von: Karsten Voges [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 28. Dezember 2005 12:15 An: poi-user@jakarta.apache.org Betreff: How to clone Rows or move rows between sheets? Hi, I wonder if it is possible to clone a row or move a row from one sheet to another? I haven't found anything in the API(beside addRow() which is a private Method in HSSFSheet) and with Google. Backround is the following: I use/load a predefined template, including merged cells etc. I fill in text into the template. But sometimes I want to repeat a row. So I shift all rows below down one row, and then it would be great to be able to clone the UpperRow or get the row from another sheet. This should include merged cells as well. Up to now I merely copy the styles: for (int j = 0; j < rowToCopy.getLastCellNum(); j++){ HSSFCell cellToCopy = rowToCopy.getCell((short)j); HSSFCell newCell = newRow.createCell((short)j); newCell.setCellStyle(cellToCopy.getCellStyle()); newCell.setCellType(cellToCopy.getCellType()); } This misses the merged Regions. Can anyone help? Is there a know workaround? Am I missing something? Thanks a lot for your time and your help, Karsten. --------------------------------------------------------------------- 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/