poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 53877] New: POI 3.8 error attempting to program a "delete columns" capability
Date Sat, 15 Sep 2012 16:15:09 GMT

          Priority: P2
            Bug ID: 53877
          Assignee: dev@poi.apache.org
           Summary: POI 3.8 error attempting to program a "delete columns"
          Severity: normal
    Classification: Unclassified
          Reporter: everymoment@comcast.net
          Hardware: PC
            Status: NEW
           Version: 3.8
         Component: HSSF
           Product: POI

Created attachment 29380
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=29380&action=edit
Demonstrates an error, possibly in HSSFrow.moveCell()

The attached java file POI_error_in_column_deletes.java attempts to demonstrate
one way to program column deletes in POI 3.8. This java program does the
  - creates a new workbook
  - creates 10 rows each containing 10 empty cells
  - fills in range A3:E3 with "A", "B", "C", "D", and "E"
  - runs code designed to delete columns B and C,
      but instead of getting ADE in the third row it gets ACE
  - outputs a workbook testDeleteColumns.xls

It get the same incorrect result in POI 3.8 and in the
poi-3.9-beta1-20120915.jar nightly.

The inner loop of deleting columns, which contains the error, is the method

/** Removes a cell at START_COL and shifts remainder of row to the left by one.
 * @param row row from which to delete and shift cells
 * @param START_COL index of cell to remove
private static void deleteColumnFromRow(HSSFRow row, final int START_COL){
    if(START_COL >= COLS){
    HSSFCell check = row.getCell(START_COL);
        "        deleteColumnFromRow: row = "+
    HSSFCell cell = null;
    for(int col = START_COL+1; col < COLS; col++){
        int source = col;
        int destination = col-1;
        cell = row.getCell(source);
        if(null != row.getCell(destination)){
            // Because the API says the destination cannot exist,
            // the destination has been deleted. The API reference is
        if(null != cell){
            // I THINK THE ERROR MIGHT BE IN moveCell().

You are receiving this mail because:
You are the assignee for the bug.

To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org

View raw message