Examples of RecordCollector


Examples of org.apache.poi.hssf.usermodel.RecordInspector.RecordCollector

     */
    public void testProtectSheetRecordOrder_bug47363a() {
        HSSFWorkbook wb = new HSSFWorkbook();
        HSSFSheet s = wb.createSheet();
        s.protectSheet("secret");
        RecordCollector rc = new RecordCollector();
        s.getSheet().visitContainedRecords(rc, 0);
        Record[] recs = rc.getRecords();
        int nRecs = recs.length;
        if (recs[nRecs-2] instanceof PasswordRecord && recs[nRecs-5] instanceof DimensionsRecord) {
           throw new AssertionFailedError("Identified bug 47363a - PASSWORD after DIMENSION");
        }
        // Check that protection block is together, and before DIMENSION
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.RecordInspector.RecordCollector

            if (expMsg.equals(e.getMessage())) {
                throw new AssertionFailedError("Identified bug 47363b");
            }
            throw e;
        }
        RecordCollector rc;
        rc = new RecordCollector();
        sheet.getSheet().visitContainedRecords(rc, 0);
        int nRecsWithProtection = rc.getRecords().length;

        sheet.protectSheet(null);
        rc = new RecordCollector();
        sheet.getSheet().visitContainedRecords(rc, 0);
        int nRecsWithoutProtection = rc.getRecords().length;

        assertEquals(4, nRecsWithProtection - nRecsWithoutProtection);
    }
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.RecordInspector.RecordCollector

  private static Sheet createSheet(List<Record> inRecs) {
    return Sheet.createSheet(new RecordStream(inRecs, 0));
  }

  private static Record[] getSheetRecords(Sheet s, int offset) {
    RecordCollector rc = new RecordCollector();
    s.visitContainedRecords(rc, offset);
    return rc.getRecords();
  }
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.RecordInspector.RecordCollector

        throw new AssertionFailedError("Identified bug 46206");
      }
      throw e;
    }

    RecordCollector rv = new RecordCollector();
    sheet.visitContainedRecords(rv, rowIx);
    Record[] outRecs = rv.getRecords();
    assertEquals(8, outRecs.length);
    DimensionsRecord dims = (DimensionsRecord) outRecs[5];
    assertEquals(rowIx, dims.getFirstRow());
    assertEquals(rowIx, dims.getLastRow());
    assertEquals(colIx, dims.getFirstCol());
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.RecordInspector.RecordCollector

        throw new AssertionFailedError("Identified bug 46776");
      }
      throw e;
    }

    RecordCollector rc = new RecordCollector();
    sheet2.visitContainedRecords(rc, 0);
    Record[] clonedRecs = rc.getRecords();
    assertEquals(recs.length+2, clonedRecs.length); // +2 for INDEX and DBCELL
  }
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.RecordInspector.RecordCollector

      if ("String record was  supplied but formula record flag is not  set".equals(e.getMessage())) {
        throw new AssertionFailedError("Identified bug 46213");
      }
      throw e;
    }
    RecordCollector rc = new RecordCollector();
    fra.visitContainedRecords(rc);
    Record[] vraRecs = rc.getRecords();
    assertEquals(1, vraRecs.length);
    assertEquals(fr, vraRecs[0]);
  }
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.RecordInspector.RecordCollector

        throw new AssertionFailedError("Identified bug 46480");
      }
      throw e;
    }

    RecordCollector rv = new RecordCollector();
    sheet.visitContainedRecords(rv, rowIx);
    Record[] outRecs = rv.getRecords();
    assertEquals(13, outRecs.length);
  }
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.RecordInspector.RecordCollector

        EOFRecord.instance,
    };
    RecordStream rs = new RecordStream(Arrays.asList(recs), 0);
    Sheet sheet = Sheet.createSheet(rs);

    RecordCollector rv = new RecordCollector();
    sheet.visitContainedRecords(rv, 0);
    Record[] outRecs = rv.getRecords();
    if (outRecs[4] == EOFRecord.instance) {
      throw new AssertionFailedError("Identified bug 46953 - EOF incorrectly appended to PSB");
    }
    assertEquals(recs.length+1, outRecs.length); // +1 for index record
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.RecordInspector.RecordCollector

        throw new AssertionFailedError("Identified bug 47199a - failed to process late margings records");
      }
      throw e;
    }

    RecordCollector rv = new RecordCollector();
    sheet.visitContainedRecords(rv, 0);
    Record[] outRecs = rv.getRecords();
    assertEquals(recs.length+1, outRecs.length); // +1 for index record

    assertEquals(BOFRecord.class, outRecs[0].getClass());
    assertEquals(IndexRecord.class, outRecs[1].getClass());
    assertEquals(HeaderRecord.class, outRecs[2].getClass());
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.RecordInspector.RecordCollector

    };
    RecordStream rs = new RecordStream(Arrays.asList(recs), 0);
    PageSettingsBlock psb = new PageSettingsBlock(rs);

    // serialize the PSB to see what records come out
    RecordCollector rc = new RecordCollector();
    psb.visitContainedRecords(rc);
    Record[] outRecs = rc.getRecords();
   
    if (outRecs.length == 2) {
      throw new AssertionFailedError("PageSettingsBlock didn't add missing header/footer records");
    }
    assertEquals(4, outRecs.length);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.