Examples of EscherAggregate


Examples of org.apache.poi.hssf.record.EscherAggregate

     *  start from scratch!
     */
    public HSSFPatriarch getDrawingPatriarch() {
        if(_patriarch != null) return _patriarch;
       
        EscherAggregate agg = getDrawingEscherAggregate();
        if(agg == null) return null;

        _patriarch = new HSSFPatriarch(this, agg);
        agg.setPatriarch(_patriarch);

        // Have it process the records into high level objects
        //  as best it can do (this step may eat anything
        //  that isn't supported, you were warned...)
        agg.convertRecordsToUserModel();

        // Return what we could cope with
        return _patriarch;
    }
View Full Code Here

Examples of org.apache.poi.hssf.record.EscherAggregate

     */
    public void dumpDrawingRecords(boolean fat)
    {
        sheet.aggregateDrawingRecords(book.getDrawingManager(), false);

        EscherAggregate r = (EscherAggregate) getSheet().findFirstRecordBySid(EscherAggregate.sid);
        List escherRecords = r.getEscherRecords();
        PrintWriter w = new PrintWriter(System.out);
        for ( Iterator iterator = escherRecords.iterator(); iterator.hasNext(); )
        {
            EscherRecord escherRecord = (EscherRecord) iterator.next();
            if (fat)
View Full Code Here

Examples of org.apache.poi.hssf.record.EscherAggregate

    {
        // Create the drawing group if it doesn't already exist.
        book.createDrawingGroup();

        sheet.aggregateDrawingRecords(book.getDrawingManager(), true);
        EscherAggregate agg = (EscherAggregate) sheet.findFirstRecordBySid(EscherAggregate.sid);
        HSSFPatriarch patriarch = new HSSFPatriarch(this, agg);
        agg.clear();     // Initially the behaviour will be to clear out any existing shapes in the sheet when
                         // creating a new patriarch.
        agg.setPatriarch(patriarch);
        return patriarch;
    }
View Full Code Here

Examples of org.apache.poi.hssf.record.EscherAggregate

            // Workbook has drawing stuff, but this sheet doesn't
            return null;
        }

        // Grab our aggregate record, and wire it up
        EscherAggregate agg = (EscherAggregate) sheet.findFirstRecordBySid(EscherAggregate.sid);
        return agg;
    }
View Full Code Here

Examples of org.apache.poi.hssf.record.EscherAggregate

     *  use this with simple drawings, otherwise call
     *  {@link HSSFSheet#createDrawingPatriarch()} and
     *  start from scratch!
     */
    public HSSFPatriarch getDrawingPatriarch() {
      EscherAggregate agg = getDrawingEscherAggregate();
      if(agg == null) return null;
     
        HSSFPatriarch patriarch = new HSSFPatriarch(this, agg);
        agg.setPatriarch(patriarch);

        // Have it process the records into high level objects
        //  as best it can do (this step may eat anything
        //  that isn't supported, you were warned...)
        agg.convertRecordsToUserModel();

        // Return what we could cope with
        return patriarch;
    }
View Full Code Here

Examples of org.apache.poi.hssf.record.EscherAggregate

        }

        //check if the cloned sheet has drawings
        int aggLoc = sheet.aggregateDrawingRecords(drawingManager, false);
        if(aggLoc != -1) {
            EscherAggregate agg = (EscherAggregate) sheet.findFirstRecordBySid(EscherAggregate.sid);
            EscherContainerRecord escherContainer = agg.getEscherContainer();
            if (escherContainer == null) {
                return;
            }

            EscherDggRecord dgg = drawingManager.getDgg();
View Full Code Here

Examples of org.apache.poi.hssf.record.EscherAggregate

            if(info != null) {
                aggs.put(i, info);
                HSSFPatriarch p = sheet.getDrawingPatriarch();

                // compare aggregate.serialize() with raw bytes from the record stream
                EscherAggregate agg = HSSFTestHelper.getEscherAggregate(p);

                byte[] dgBytes1 = info.getRawBytes();
                byte[] dgBytes2 = agg.serialize();

                assertEquals("different size of raw data ande aggregate.serialize()", dgBytes1.length, dgBytes2.length);
                assertTrue("raw drawing data ("+dgBytes1.length+" bytes) and aggregate.serialize() are different.",
                        Arrays.equals(dgBytes1, dgBytes2));
            }
View Full Code Here

Examples of org.apache.poi.hssf.record.EscherAggregate

        List<RecordBase> records = ish.getRecords();
        // records to be aggregated
        List<RecordBase> dgRecords = records.subList(19, 22);
        byte[] dgBytes = toByteArray(dgRecords);
        sh.getDrawingPatriarch();
        EscherAggregate agg = (EscherAggregate) ish.findFirstRecordBySid(EscherAggregate.sid);
        assertEquals(agg.getEscherRecords().get(0).getChildRecords().size(), 3);
        assertEquals(agg.getEscherRecords().get(0).getChild(2).getRecordId(), EscherContainerRecord.SOLVER_CONTAINER);
        wb = HSSFTestDataSamples.writeOutAndReadBack(wb);
        sh = wb.getSheetAt(0);
        sh.getDrawingPatriarch();
        ish = HSSFTestHelper.getSheetForTest(sh);
        agg = (EscherAggregate) ish.findFirstRecordBySid(EscherAggregate.sid);
        assertEquals(agg.getEscherRecords().get(0).getChildRecords().size(), 3);
        assertEquals(agg.getEscherRecords().get(0).getChild(2).getRecordId(), EscherContainerRecord.SOLVER_CONTAINER);


        // collect drawing records into a byte buffer.
        agg = (EscherAggregate) ish.findFirstRecordBySid(EscherAggregate.sid);
        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));
    }
View Full Code Here

Examples of org.apache.poi.hssf.record.EscherAggregate

        List<RecordBase> dgRecords = records.subList(19, 23);
        byte[] dgBytes = toByteArray(dgRecords);
        sh.getDrawingPatriarch();

        // collect drawing records into a byte buffer.
        EscherAggregate agg = (EscherAggregate) ish.findFirstRecordBySid(EscherAggregate.sid);
        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));
    }
View Full Code Here

Examples of org.apache.poi.hssf.record.EscherAggregate

        List<RecordBase> dgRecords = records.subList(19, 21);
        byte[] dgBytes = toByteArray(dgRecords);
        sh.getDrawingPatriarch();

        // collect drawing records into a byte buffer.
        EscherAggregate agg = (EscherAggregate) ish.findFirstRecordBySid(EscherAggregate.sid);
        byte[] dgBytesAfterSave = agg.serialize();
        assertEquals("different size of drawing data before and after save", dgBytes.length, dgBytesAfterSave.length);
        for (int i=0; i< dgBytes.length; i++){
            if (dgBytes[i] != dgBytesAfterSave[i]){
                System.out.println("pos = " + i);
            }
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.