Search in sources :

Example 11 with DimensionsRecord

use of org.apache.poi.hssf.record.DimensionsRecord in project poi by apache.

the class TestSheet method testRowAggregation.

/**
	 * Makes sure all rows registered for this sheet are aggregated, they were being skipped
	 *
	 */
@Test
public void testRowAggregation() {
    List<Record> records = new ArrayList<Record>();
    records.add(InternalSheet.createBOF());
    records.add(new DimensionsRecord());
    records.add(new RowRecord(0));
    records.add(new RowRecord(1));
    FormulaRecord formulaRecord = new FormulaRecord();
    formulaRecord.setCachedResultTypeString();
    records.add(formulaRecord);
    records.add(new StringRecord());
    records.add(new RowRecord(2));
    records.add(createWindow2Record());
    records.add(EOFRecord.instance);
    InternalSheet sheet = createSheet(records);
    assertNotNull("Row [2] was skipped", sheet.getRow(2));
}
Also used : FormulaRecord(org.apache.poi.hssf.record.FormulaRecord) RowRecord(org.apache.poi.hssf.record.RowRecord) ArrayList(java.util.ArrayList) StringRecord(org.apache.poi.hssf.record.StringRecord) GutsRecord(org.apache.poi.hssf.record.GutsRecord) MergeCellsRecord(org.apache.poi.hssf.record.MergeCellsRecord) DrawingRecord(org.apache.poi.hssf.record.DrawingRecord) NoteRecord(org.apache.poi.hssf.record.NoteRecord) Record(org.apache.poi.hssf.record.Record) ObjRecord(org.apache.poi.hssf.record.ObjRecord) EOFRecord(org.apache.poi.hssf.record.EOFRecord) RowRecord(org.apache.poi.hssf.record.RowRecord) ColumnInfoRecord(org.apache.poi.hssf.record.ColumnInfoRecord) WindowTwoRecord(org.apache.poi.hssf.record.WindowTwoRecord) EscherDggRecord(org.apache.poi.ddf.EscherDggRecord) TextObjectRecord(org.apache.poi.hssf.record.TextObjectRecord) IndexRecord(org.apache.poi.hssf.record.IndexRecord) BOFRecord(org.apache.poi.hssf.record.BOFRecord) NumberRecord(org.apache.poi.hssf.record.NumberRecord) MulBlankRecord(org.apache.poi.hssf.record.MulBlankRecord) UncalcedRecord(org.apache.poi.hssf.record.UncalcedRecord) DimensionsRecord(org.apache.poi.hssf.record.DimensionsRecord) BlankRecord(org.apache.poi.hssf.record.BlankRecord) FormulaRecord(org.apache.poi.hssf.record.FormulaRecord) DimensionsRecord(org.apache.poi.hssf.record.DimensionsRecord) StringRecord(org.apache.poi.hssf.record.StringRecord) Test(org.junit.Test)

Example 12 with DimensionsRecord

use of org.apache.poi.hssf.record.DimensionsRecord in project poi by apache.

the class TestSheet method testMovingMergedRegion.

/**
	 * Bug: 22922 (Reported by Xuemin Guan)
	 * <p>
	 * Remove mergedregion fails when a sheet loses records after an initial CreateSheet
	 * fills up the records.
	 *
	 */
@Test
public void testMovingMergedRegion() {
    List<Record> records = new ArrayList<Record>();
    CellRangeAddress[] cras = { new CellRangeAddress(0, 1, 0, 2) };
    MergeCellsRecord merged = new MergeCellsRecord(cras, 0, cras.length);
    records.add(BOFRecord.createSheetBOF());
    records.add(new DimensionsRecord());
    records.add(new RowRecord(0));
    records.add(new RowRecord(1));
    records.add(new RowRecord(2));
    records.add(createWindow2Record());
    records.add(EOFRecord.instance);
    records.add(merged);
    InternalSheet sheet = createSheet(records);
    // TODO - what does this line do?
    sheet.getRecords().remove(0);
    //stub object to throw off list INDEX operations
    sheet.removeMergedRegion(0);
    assertEquals("Should be no more merged regions", 0, sheet.getNumMergedRegions());
}
Also used : RowRecord(org.apache.poi.hssf.record.RowRecord) MergeCellsRecord(org.apache.poi.hssf.record.MergeCellsRecord) ArrayList(java.util.ArrayList) StringRecord(org.apache.poi.hssf.record.StringRecord) GutsRecord(org.apache.poi.hssf.record.GutsRecord) MergeCellsRecord(org.apache.poi.hssf.record.MergeCellsRecord) DrawingRecord(org.apache.poi.hssf.record.DrawingRecord) NoteRecord(org.apache.poi.hssf.record.NoteRecord) Record(org.apache.poi.hssf.record.Record) ObjRecord(org.apache.poi.hssf.record.ObjRecord) EOFRecord(org.apache.poi.hssf.record.EOFRecord) RowRecord(org.apache.poi.hssf.record.RowRecord) ColumnInfoRecord(org.apache.poi.hssf.record.ColumnInfoRecord) WindowTwoRecord(org.apache.poi.hssf.record.WindowTwoRecord) EscherDggRecord(org.apache.poi.ddf.EscherDggRecord) TextObjectRecord(org.apache.poi.hssf.record.TextObjectRecord) IndexRecord(org.apache.poi.hssf.record.IndexRecord) BOFRecord(org.apache.poi.hssf.record.BOFRecord) NumberRecord(org.apache.poi.hssf.record.NumberRecord) MulBlankRecord(org.apache.poi.hssf.record.MulBlankRecord) UncalcedRecord(org.apache.poi.hssf.record.UncalcedRecord) DimensionsRecord(org.apache.poi.hssf.record.DimensionsRecord) BlankRecord(org.apache.poi.hssf.record.BlankRecord) FormulaRecord(org.apache.poi.hssf.record.FormulaRecord) DimensionsRecord(org.apache.poi.hssf.record.DimensionsRecord) CellRangeAddress(org.apache.poi.ss.util.CellRangeAddress) Test(org.junit.Test)

Aggregations

DimensionsRecord (org.apache.poi.hssf.record.DimensionsRecord)12 RowRecord (org.apache.poi.hssf.record.RowRecord)8 Test (org.junit.Test)8 BlankRecord (org.apache.poi.hssf.record.BlankRecord)7 MulBlankRecord (org.apache.poi.hssf.record.MulBlankRecord)7 ObjRecord (org.apache.poi.hssf.record.ObjRecord)7 Record (org.apache.poi.hssf.record.Record)7 WindowTwoRecord (org.apache.poi.hssf.record.WindowTwoRecord)7 EscherDggRecord (org.apache.poi.ddf.EscherDggRecord)6 BOFRecord (org.apache.poi.hssf.record.BOFRecord)6 ColumnInfoRecord (org.apache.poi.hssf.record.ColumnInfoRecord)6 DrawingRecord (org.apache.poi.hssf.record.DrawingRecord)6 EOFRecord (org.apache.poi.hssf.record.EOFRecord)6 FormulaRecord (org.apache.poi.hssf.record.FormulaRecord)6 GutsRecord (org.apache.poi.hssf.record.GutsRecord)6 IndexRecord (org.apache.poi.hssf.record.IndexRecord)6 MergeCellsRecord (org.apache.poi.hssf.record.MergeCellsRecord)6 NoteRecord (org.apache.poi.hssf.record.NoteRecord)6 NumberRecord (org.apache.poi.hssf.record.NumberRecord)6 StringRecord (org.apache.poi.hssf.record.StringRecord)6