Search in sources :

Example 1 with EOFRecord

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

the class RecordOrderer method findDataValidationTableInsertPos.

/**
	 * Finds the index where the sheet validations header record should be inserted
	 * @param records the records for this sheet
	 *
	 * + WINDOW2
	 * o SCL
	 * o PANE
	 * oo SELECTION
	 * o STANDARDWIDTH
	 * oo MERGEDCELLS
	 * o LABELRANGES
	 * o PHONETICPR
	 * o Conditional Formatting Table
	 * o Hyperlink Table
	 * o Data Validity Table
	 * o SHEETLAYOUT
	 * o SHEETPROTECTION
	 * o RANGEPROTECTION
	 * + EOF
	 */
private static int findDataValidationTableInsertPos(List<RecordBase> records) {
    int i = records.size() - 1;
    if (!(records.get(i) instanceof EOFRecord)) {
        throw new IllegalStateException("Last sheet record should be EOFRecord");
    }
    while (i > 0) {
        i--;
        RecordBase rb = records.get(i);
        if (isDVTPriorRecord(rb)) {
            Record nextRec = (Record) records.get(i + 1);
            if (!isDVTSubsequentRecord(nextRec.getSid())) {
                throw new IllegalStateException("Unexpected (" + nextRec.getClass().getName() + ") found after (" + rb.getClass().getName() + ")");
            }
            return i + 1;
        }
        Record rec = (Record) rb;
        if (!isDVTSubsequentRecord(rec.getSid())) {
            throw new IllegalStateException("Unexpected (" + rec.getClass().getName() + ") while looking for DV Table insert pos");
        }
    }
    return 0;
}
Also used : EOFRecord(org.apache.poi.hssf.record.EOFRecord) RecordBase(org.apache.poi.hssf.record.RecordBase) DrawingSelectionRecord(org.apache.poi.hssf.record.DrawingSelectionRecord) GutsRecord(org.apache.poi.hssf.record.GutsRecord) UnknownRecord(org.apache.poi.hssf.record.UnknownRecord) ArrayRecord(org.apache.poi.hssf.record.ArrayRecord) DefaultColWidthRecord(org.apache.poi.hssf.record.DefaultColWidthRecord) DateWindow1904Record(org.apache.poi.hssf.record.DateWindow1904Record) DefaultRowHeightRecord(org.apache.poi.hssf.record.DefaultRowHeightRecord) GridsetRecord(org.apache.poi.hssf.record.GridsetRecord) SCLRecord(org.apache.poi.hssf.record.SCLRecord) DrawingRecord(org.apache.poi.hssf.record.DrawingRecord) BoolErrRecord(org.apache.poi.hssf.record.BoolErrRecord) Record(org.apache.poi.hssf.record.Record) HyperlinkRecord(org.apache.poi.hssf.record.HyperlinkRecord) ObjRecord(org.apache.poi.hssf.record.ObjRecord) EOFRecord(org.apache.poi.hssf.record.EOFRecord) PrintHeadersRecord(org.apache.poi.hssf.record.PrintHeadersRecord) RefModeRecord(org.apache.poi.hssf.record.RefModeRecord) PrecisionRecord(org.apache.poi.hssf.record.PrecisionRecord) RowRecord(org.apache.poi.hssf.record.RowRecord) SharedFormulaRecord(org.apache.poi.hssf.record.SharedFormulaRecord) CalcCountRecord(org.apache.poi.hssf.record.CalcCountRecord) ColumnInfoRecord(org.apache.poi.hssf.record.ColumnInfoRecord) WindowTwoRecord(org.apache.poi.hssf.record.WindowTwoRecord) PrintGridlinesRecord(org.apache.poi.hssf.record.PrintGridlinesRecord) IterationRecord(org.apache.poi.hssf.record.IterationRecord) CalcModeRecord(org.apache.poi.hssf.record.CalcModeRecord) SelectionRecord(org.apache.poi.hssf.record.SelectionRecord) TextObjectRecord(org.apache.poi.hssf.record.TextObjectRecord) LabelSSTRecord(org.apache.poi.hssf.record.LabelSSTRecord) RKRecord(org.apache.poi.hssf.record.RKRecord) IndexRecord(org.apache.poi.hssf.record.IndexRecord) BOFRecord(org.apache.poi.hssf.record.BOFRecord) LabelRecord(org.apache.poi.hssf.record.LabelRecord) DVALRecord(org.apache.poi.hssf.record.DVALRecord) WindowOneRecord(org.apache.poi.hssf.record.WindowOneRecord) DeltaRecord(org.apache.poi.hssf.record.DeltaRecord) PaneRecord(org.apache.poi.hssf.record.PaneRecord) NumberRecord(org.apache.poi.hssf.record.NumberRecord) FeatRecord(org.apache.poi.hssf.record.FeatRecord) ViewDefinitionRecord(org.apache.poi.hssf.record.pivottable.ViewDefinitionRecord) SaveRecalcRecord(org.apache.poi.hssf.record.SaveRecalcRecord) TableRecord(org.apache.poi.hssf.record.TableRecord) 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)

Example 2 with EOFRecord

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

the class TestSheet method testCreateSheet.

@Test
public void testCreateSheet() {
    // Check we're adding row and cell aggregates
    List<Record> records = new ArrayList<Record>();
    records.add(BOFRecord.createSheetBOF());
    records.add(new DimensionsRecord());
    records.add(createWindow2Record());
    records.add(EOFRecord.instance);
    InternalSheet sheet = createSheet(records);
    Record[] outRecs = getSheetRecords(sheet, 0);
    int pos = 0;
    assertTrue(outRecs[pos++] instanceof BOFRecord);
    assertTrue(outRecs[pos++] instanceof IndexRecord);
    assertTrue(outRecs[pos++] instanceof DimensionsRecord);
    assertTrue(outRecs[pos++] instanceof WindowTwoRecord);
    assertTrue(outRecs[pos++] instanceof EOFRecord);
}
Also used : EOFRecord(org.apache.poi.hssf.record.EOFRecord) 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) BOFRecord(org.apache.poi.hssf.record.BOFRecord) WindowTwoRecord(org.apache.poi.hssf.record.WindowTwoRecord) IndexRecord(org.apache.poi.hssf.record.IndexRecord) Test(org.junit.Test)

Example 3 with EOFRecord

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

the class TestDrawingAggregate method testUnhandledContinue2.

@Test
public void testUnhandledContinue2() throws IOException {
    String data = "H4sIAAAAAAAAAO3bdVRUW9sA8AGGrqFHSlpAhSEcQAkJ6UYQyaFBmiEFpCVEOiREGikJSekGlRJQuiQl" + "FQFB4ptBvxvIvd+97/fete4f7rWYc9aZc4aZw7P3/s3zbFYB/FiEANTNeD4AAATA2sQCAADIH0wgAEAI" + "QNv04kNugZusiGMoAOxNEODHhgrAObkOgLgGHfDt/GlMAID4+3EUxHEADgDgB8DdVEbsNgDAgPMAHxQl" + "nzpAAwoI8XsbUfh1QwCvUPiNAIBjFCzEO/BuoUOeiYZ89fPA60AloCBQGCgO5EE8XgPKA4WA/MCrQDoA" + "F+IsRgDDR0VM5JUAwHVAbosYYl9ZDg1ICsA4+Sz0gM3dkJpDxN4s4gwSxFZb3NbG0cTGUf+mm50JXJfD" + "1doqJrJbthUC6tjw3QAtsFvnYRJZvMDMlyLTPQ+TzrYehmInaLpMTTqKcMzi0JotHH9kzL01ZkHKc6Ni" + "kq2K4yJorozv7TaO8FulNhosxSW8sMlIXxqugsRXD+7W4bYy1NBcBKvi7KqW0pqLcXjSxXM+DifJFmzX" + "wxikWpWZvDlUODjJ7JArLYfB6yRHcy9MRtBma/86sYUxiBBz5k0WQBxc2B4jM7/6OjxudljZdFGvxQ/f" + "I5br+tFosU4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+ "HHsd2cRPfYDLb947Lk7gZ+GC4eHSSZOSpyyjymYYGpldboruhWaJ+Zrv1pBYBZOeDTkx2e3QNJ3kGOWn" + "CwNHE0dGW3XVEw22wnyV3ZWHgQtSW1l7Ie3DK+EJ4M1elgNLCROj6Kc9JiPkjwRTa5nZ+DeZIzvhNztc" + "IdRh9Gahzn1WMyPAGD5jaeBIGikU2NJljiMZk0iTYQ9qthHvU+HSvpj7Gc5OkB0gnwqWS7wjF2mlx7qW" + "ejVIA3zh/jI0yyWUkjiUk83Y+NpxU/P1tlAW8okwvMc8wVD/tkeZbPNX7Z5d6XrKE+5xlgU8v6UEuHpF" + "f5MSMOX48rHxlS/uHh8qXt4b0/XNFyz2hQYvJN4p3ajgidFr4ZRfSPNEpSir9y9KDrYOVdO4CW7qdt/K" + "+WYBiMi6TViJ81ZbTD33t0UCQOQiARRdLO2m/BbqGy+fo0caYztLvt5inEq5VDSzV+2TRLc0Vn9ne12i" + "4lY8ar4nviaKEVyUl4u5tPzLIU0JNEfhE8lZUWw72xT81yoD4mVICkRB6fG/U6DsfynQeUIBLWX30o6a" + "qfVQileiZT0plgOsMk1JVdN2CfnpkWQBVrsO532MLkWjW8bOkRKMN3JX12sVVynXye/ds7yIGShNwoNT" + "Xq4rH9RlyfEo4WmYXEGsLK6pyocQ0sRtfp2yVpeJCKy30uPKz8NE3gkeTx5h6XziEObeJvWsj6opUHpX" + "8xQ7myirkq/lAxH1K0x3m6MMPnT0z1rPCPVfsKmaXnpHCiG43wKLSH2fpttVq3G3Nl4LWyr/SHo+Lwvi" + "p9IQmzVDjm0LdSLqeHM8ILiJRsdoNYS93WyEhi7IOdKXZLTCvCLifxTMEi+snNzAtfevk8DpkejvSeB0" + "BPza/oPKABD5z4SARKQEELP1WQsFMc+QwP8ATkmhK404AAA=";
    byte[] dgBytes = decompress(data);
    List<Record> dgRecords = RecordFactory.createRecords(new ByteArrayInputStream(dgBytes));
    assertEquals(14, dgRecords.size());
    short[] expectedSids = { DrawingRecord.sid, ObjRecord.sid, DrawingRecord.sid, ObjRecord.sid, DrawingRecord.sid, ObjRecord.sid, DrawingRecord.sid, ObjRecord.sid, ContinueRecord.sid, ObjRecord.sid, ContinueRecord.sid, ObjRecord.sid, ContinueRecord.sid, ObjRecord.sid };
    for (int i = 0; i < expectedSids.length; i++) {
        assertEquals("unexpected record.sid and index[" + i + "]", expectedSids[i], dgRecords.get(i).getSid());
    }
    DrawingManager2 drawingManager = new DrawingManager2(new EscherDggRecord());
    // create a dummy sheet consisting of our test data
    InternalSheet sheet = InternalSheet.createSheet();
    List<RecordBase> records = sheet.getRecords();
    records.clear();
    records.addAll(dgRecords);
    records.add(EOFRecord.instance);
    sheet.aggregateDrawingRecords(drawingManager, false);
    assertEquals("drawing was not fully aggregated", 2, records.size());
    assertTrue("expected EscherAggregate", records.get(0) instanceof EscherAggregate);
    assertTrue("expected EOFRecord", records.get(1) instanceof EOFRecord);
    EscherAggregate agg = (EscherAggregate) records.get(0);
    byte[] dgBytesAfterSave = agg.serialize();
    assertEquals("different size of drawing data before and after save", dgBytes.length, dgBytesAfterSave.length);
    assertTrue("drawing data brefpore and after save is different", Arrays.equals(dgBytes, dgBytesAfterSave));
}
Also used : EOFRecord(org.apache.poi.hssf.record.EOFRecord) EscherDggRecord(org.apache.poi.ddf.EscherDggRecord) EscherAggregate(org.apache.poi.hssf.record.EscherAggregate) ByteArrayInputStream(java.io.ByteArrayInputStream) RecordBase(org.apache.poi.hssf.record.RecordBase) EscherDggRecord(org.apache.poi.ddf.EscherDggRecord) TextObjectRecord(org.apache.poi.hssf.record.TextObjectRecord) EscherRecord(org.apache.poi.ddf.EscherRecord) ContinueRecord(org.apache.poi.hssf.record.ContinueRecord) DrawingRecord(org.apache.poi.hssf.record.DrawingRecord) NoteRecord(org.apache.poi.hssf.record.NoteRecord) Record(org.apache.poi.hssf.record.Record) EscherContainerRecord(org.apache.poi.ddf.EscherContainerRecord) ObjRecord(org.apache.poi.hssf.record.ObjRecord) EOFRecord(org.apache.poi.hssf.record.EOFRecord) WindowTwoRecord(org.apache.poi.hssf.record.WindowTwoRecord) Test(org.junit.Test)

Example 4 with EOFRecord

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

the class InternalWorkbook method createWorkbook.

/**
     * read support  for low level
     * API.  Pass in an array of Record objects, A Workbook
     * object is constructed and passed back with all of its initialization set
     * to the passed in records and references to those records held. Unlike Sheet
     * workbook does not use an offset (its assumed to be 0) since its first in a file.
     * If you need an offset then construct a new array with a 0 offset or write your
     * own ;-p.
     *
     * @param recs an array of Record objects
     * @return Workbook object
     */
public static InternalWorkbook createWorkbook(List<Record> recs) {
    LOG.log(DEBUG, "Workbook (readfile) created with reclen=", recs.size());
    InternalWorkbook retval = new InternalWorkbook();
    List<Record> records = new ArrayList<Record>(recs.size() / 3);
    retval.records.setRecords(records);
    boolean eofPassed = false;
    for (int k = 0; k < recs.size(); k++) {
        Record rec = recs.get(k);
        String logObj;
        switch(rec.getSid()) {
            case EOFRecord.sid:
                logObj = "workbook eof";
                break;
            case BoundSheetRecord.sid:
                logObj = "boundsheet";
                retval.boundsheets.add((BoundSheetRecord) rec);
                retval.records.setBspos(k);
                break;
            case SSTRecord.sid:
                logObj = "sst";
                retval.sst = (SSTRecord) rec;
                break;
            case FontRecord.sid:
                logObj = "font";
                retval.records.setFontpos(k);
                retval.numfonts++;
                break;
            case ExtendedFormatRecord.sid:
                logObj = "XF";
                retval.records.setXfpos(k);
                retval.numxfs++;
                break;
            case TabIdRecord.sid:
                logObj = "tabid";
                retval.records.setTabpos(k);
                break;
            case ProtectRecord.sid:
                logObj = "protect";
                retval.records.setProtpos(k);
                break;
            case BackupRecord.sid:
                logObj = "backup";
                retval.records.setBackuppos(k);
                break;
            case ExternSheetRecord.sid:
                throw new RecordFormatException("Extern sheet is part of LinkTable");
            case NameRecord.sid:
            case SupBookRecord.sid:
                // LinkTable can start with either of these
                LOG.log(DEBUG, "found SupBook record at " + k);
                retval.linkTable = new LinkTable(recs, k, retval.records, retval.commentRecords);
                k += retval.linkTable.getRecordCount() - 1;
                continue;
            case FormatRecord.sid:
                logObj = "format";
                FormatRecord fr = (FormatRecord) rec;
                retval.formats.add(fr);
                retval.maxformatid = retval.maxformatid >= fr.getIndexCode() ? retval.maxformatid : fr.getIndexCode();
                break;
            case DateWindow1904Record.sid:
                logObj = "datewindow1904";
                retval.uses1904datewindowing = ((DateWindow1904Record) rec).getWindowing() == 1;
                break;
            case PaletteRecord.sid:
                logObj = "palette";
                retval.records.setPalettepos(k);
                break;
            case WindowOneRecord.sid:
                logObj = "WindowOneRecord";
                retval.windowOne = (WindowOneRecord) rec;
                break;
            case WriteAccessRecord.sid:
                logObj = "WriteAccess";
                retval.writeAccess = (WriteAccessRecord) rec;
                break;
            case WriteProtectRecord.sid:
                logObj = "WriteProtect";
                retval.writeProtect = (WriteProtectRecord) rec;
                break;
            case FileSharingRecord.sid:
                logObj = "FileSharing";
                retval.fileShare = (FileSharingRecord) rec;
                break;
            case NameCommentRecord.sid:
                logObj = "NameComment";
                final NameCommentRecord ncr = (NameCommentRecord) rec;
                retval.commentRecords.put(ncr.getNameText(), ncr);
                break;
            case HyperlinkRecord.sid:
                // Look for other interesting values that follow the EOFRecord
                logObj = "Hyperlink";
                retval.hyperlinks.add((HyperlinkRecord) rec);
                break;
            default:
                logObj = "(sid=" + rec.getSid() + ")";
                break;
        }
        if (!eofPassed) {
            records.add(rec);
        }
        LOG.log(DEBUG, "found " + logObj + " record at " + k);
        if (rec.getSid() == EOFRecord.sid) {
            eofPassed = true;
        }
    }
    if (retval.windowOne == null) {
        retval.windowOne = createWindowOne();
    }
    LOG.log(DEBUG, "exit create workbook from existing file function");
    return retval;
}
Also used : RecordFormatException(org.apache.poi.util.RecordFormatException) ArrayList(java.util.ArrayList) WindowProtectRecord(org.apache.poi.hssf.record.WindowProtectRecord) PasswordRev4Record(org.apache.poi.hssf.record.PasswordRev4Record) DateWindow1904Record(org.apache.poi.hssf.record.DateWindow1904Record) FormatRecord(org.apache.poi.hssf.record.FormatRecord) BookBoolRecord(org.apache.poi.hssf.record.BookBoolRecord) StyleRecord(org.apache.poi.hssf.record.StyleRecord) RecalcIdRecord(org.apache.poi.hssf.record.RecalcIdRecord) EscherBSERecord(org.apache.poi.ddf.EscherBSERecord) EscherOptRecord(org.apache.poi.ddf.EscherOptRecord) HideObjRecord(org.apache.poi.hssf.record.HideObjRecord) Record(org.apache.poi.hssf.record.Record) EscherContainerRecord(org.apache.poi.ddf.EscherContainerRecord) HyperlinkRecord(org.apache.poi.hssf.record.HyperlinkRecord) ProtectionRev4Record(org.apache.poi.hssf.record.ProtectionRev4Record) EOFRecord(org.apache.poi.hssf.record.EOFRecord) MMSRecord(org.apache.poi.hssf.record.MMSRecord) PrecisionRecord(org.apache.poi.hssf.record.PrecisionRecord) BoundSheetRecord(org.apache.poi.hssf.record.BoundSheetRecord) CountryRecord(org.apache.poi.hssf.record.CountryRecord) EscherSpRecord(org.apache.poi.ddf.EscherSpRecord) NameCommentRecord(org.apache.poi.hssf.record.NameCommentRecord) FnGroupCountRecord(org.apache.poi.hssf.record.FnGroupCountRecord) DrawingGroupRecord(org.apache.poi.hssf.record.DrawingGroupRecord) BackupRecord(org.apache.poi.hssf.record.BackupRecord) EscherSplitMenuColorsRecord(org.apache.poi.ddf.EscherSplitMenuColorsRecord) ExternSheetRecord(org.apache.poi.hssf.record.ExternSheetRecord) WriteAccessRecord(org.apache.poi.hssf.record.WriteAccessRecord) EscherDggRecord(org.apache.poi.ddf.EscherDggRecord) CodepageRecord(org.apache.poi.hssf.record.CodepageRecord) EscherRecord(org.apache.poi.ddf.EscherRecord) NameRecord(org.apache.poi.hssf.record.NameRecord) BOFRecord(org.apache.poi.hssf.record.BOFRecord) FilePassRecord(org.apache.poi.hssf.record.FilePassRecord) FontRecord(org.apache.poi.hssf.record.FontRecord) UseSelFSRecord(org.apache.poi.hssf.record.UseSelFSRecord) WindowOneRecord(org.apache.poi.hssf.record.WindowOneRecord) WriteProtectRecord(org.apache.poi.hssf.record.WriteProtectRecord) ProtectRecord(org.apache.poi.hssf.record.ProtectRecord) InterfaceHdrRecord(org.apache.poi.hssf.record.InterfaceHdrRecord) DSFRecord(org.apache.poi.hssf.record.DSFRecord) InterfaceEndRecord(org.apache.poi.hssf.record.InterfaceEndRecord) SupBookRecord(org.apache.poi.hssf.record.SupBookRecord) SSTRecord(org.apache.poi.hssf.record.SSTRecord) TabIdRecord(org.apache.poi.hssf.record.TabIdRecord) PasswordRecord(org.apache.poi.hssf.record.PasswordRecord) PaletteRecord(org.apache.poi.hssf.record.PaletteRecord) EscherDgRecord(org.apache.poi.ddf.EscherDgRecord) ExtSSTRecord(org.apache.poi.hssf.record.ExtSSTRecord) ExtendedFormatRecord(org.apache.poi.hssf.record.ExtendedFormatRecord) FileSharingRecord(org.apache.poi.hssf.record.FileSharingRecord) RefreshAllRecord(org.apache.poi.hssf.record.RefreshAllRecord) UnicodeString(org.apache.poi.hssf.record.common.UnicodeString) DateWindow1904Record(org.apache.poi.hssf.record.DateWindow1904Record) FormatRecord(org.apache.poi.hssf.record.FormatRecord) ExtendedFormatRecord(org.apache.poi.hssf.record.ExtendedFormatRecord) NameCommentRecord(org.apache.poi.hssf.record.NameCommentRecord)

Example 5 with EOFRecord

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

the class TestDrawingAggregate method testUnhandledContinue.

@Test
public void testUnhandledContinue() throws IOException {
    String data = "H4sIAAAAAAAAAO3adVRU2/4A8EPHAEOnlEooNaSUdCNIg4CUDCEtQ6gwlITSjYiSkoKA0ikg0i1IyCjS" + "QwpSEr8B73v3PS6+9+67vz/eH+615pyz9tn71PqevT/rfGcJOIcLBtDXrNgAgBjAXcMFAAAb9SPDBAAw" + "gLGmzna8xlxjR9WhAXhrxMAfCzqAf9IPQPXBAn6078IBgAyCH/VgVD2ADwCxAGhNBbXpc9LUF2h8n4we" + "iOoNAKEnywaAFmAEGtDQABLgCA0AcAHfZvLjeozjc+gAUMATgAEygBNqzQTwHl8lcH5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bh2EV1VrM2gkFVGxYum4qEsJHd2DPj6kJnJzVTADlCZWR7ItRI7zEPBUU2RiU8t1G6QOxXMhpekJvVQ4" + "IppKQdVys+cLtUY6Un0+hI2Z0wMzAxO8Lr0LbaILk8WtNsxpaFYMrTjC22723OH5GFkUi+ux8An2Hi0F" + "fvcr1v8aFU6POn+OCqfj4ffS/e+pcOEMKhABrCdUAAPhwB+pQHYGFcT/BBUEz6LC/wGpc+eRNSkAAA==";
    byte[] dgBytes = decompress(data);
    List<Record> dgRecords = RecordFactory.createRecords(new ByteArrayInputStream(dgBytes));
    assertEquals(20, dgRecords.size());
    short[] expectedSids = { DrawingRecord.sid, ObjRecord.sid, DrawingRecord.sid, TextObjectRecord.sid, DrawingRecord.sid, ObjRecord.sid, DrawingRecord.sid, TextObjectRecord.sid, DrawingRecord.sid, ObjRecord.sid, DrawingRecord.sid, TextObjectRecord.sid, DrawingRecord.sid, ObjRecord.sid, DrawingRecord.sid, TextObjectRecord.sid, ContinueRecord.sid, ObjRecord.sid, ContinueRecord.sid, TextObjectRecord.sid };
    for (int i = 0; i < expectedSids.length; i++) {
        assertEquals("unexpected record.sid and index[" + i + "]", expectedSids[i], dgRecords.get(i).getSid());
    }
    DrawingManager2 drawingManager = new DrawingManager2(new EscherDggRecord());
    // create a dummy sheet consisting of our test data
    InternalSheet sheet = InternalSheet.createSheet();
    List<RecordBase> records = sheet.getRecords();
    records.clear();
    records.addAll(dgRecords);
    records.add(EOFRecord.instance);
    sheet.aggregateDrawingRecords(drawingManager, false);
    assertEquals("drawing was not fully aggregated", 2, records.size());
    assertTrue("expected EscherAggregate", records.get(0) instanceof EscherAggregate);
    assertTrue("expected EOFRecord", records.get(1) instanceof EOFRecord);
    EscherAggregate agg = (EscherAggregate) records.get(0);
    byte[] dgBytesAfterSave = agg.serialize();
    assertEquals("different size of drawing data before and after save", dgBytes.length, dgBytesAfterSave.length);
    assertTrue("drawing data before and after save is different", Arrays.equals(dgBytes, dgBytesAfterSave));
}
Also used : EOFRecord(org.apache.poi.hssf.record.EOFRecord) EscherDggRecord(org.apache.poi.ddf.EscherDggRecord) EscherAggregate(org.apache.poi.hssf.record.EscherAggregate) ByteArrayInputStream(java.io.ByteArrayInputStream) RecordBase(org.apache.poi.hssf.record.RecordBase) EscherDggRecord(org.apache.poi.ddf.EscherDggRecord) TextObjectRecord(org.apache.poi.hssf.record.TextObjectRecord) EscherRecord(org.apache.poi.ddf.EscherRecord) ContinueRecord(org.apache.poi.hssf.record.ContinueRecord) DrawingRecord(org.apache.poi.hssf.record.DrawingRecord) NoteRecord(org.apache.poi.hssf.record.NoteRecord) Record(org.apache.poi.hssf.record.Record) EscherContainerRecord(org.apache.poi.ddf.EscherContainerRecord) ObjRecord(org.apache.poi.hssf.record.ObjRecord) EOFRecord(org.apache.poi.hssf.record.EOFRecord) WindowTwoRecord(org.apache.poi.hssf.record.WindowTwoRecord) Test(org.junit.Test)

Aggregations

EOFRecord (org.apache.poi.hssf.record.EOFRecord)9 BOFRecord (org.apache.poi.hssf.record.BOFRecord)7 Record (org.apache.poi.hssf.record.Record)6 EscherDggRecord (org.apache.poi.ddf.EscherDggRecord)4 DrawingRecord (org.apache.poi.hssf.record.DrawingRecord)4 RecordBase (org.apache.poi.hssf.record.RecordBase)4 Test (org.junit.Test)4 ByteArrayInputStream (java.io.ByteArrayInputStream)3 EscherContainerRecord (org.apache.poi.ddf.EscherContainerRecord)3 EscherRecord (org.apache.poi.ddf.EscherRecord)3 ContinueRecord (org.apache.poi.hssf.record.ContinueRecord)3 ObjRecord (org.apache.poi.hssf.record.ObjRecord)3 TextObjectRecord (org.apache.poi.hssf.record.TextObjectRecord)3 WindowTwoRecord (org.apache.poi.hssf.record.WindowTwoRecord)3 ArrayList (java.util.ArrayList)2 BlankRecord (org.apache.poi.hssf.record.BlankRecord)2 BoundSheetRecord (org.apache.poi.hssf.record.BoundSheetRecord)2 ColumnInfoRecord (org.apache.poi.hssf.record.ColumnInfoRecord)2 CountryRecord (org.apache.poi.hssf.record.CountryRecord)2 DateWindow1904Record (org.apache.poi.hssf.record.DateWindow1904Record)2