Search in sources :

Example 26 with EscherAggregate

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

the class TestHSSFComment method initState.

@Test
public void initState() throws IOException {
    HSSFWorkbook wb = new HSSFWorkbook();
    HSSFSheet sh = wb.createSheet();
    HSSFPatriarch patriarch = sh.createDrawingPatriarch();
    EscherAggregate agg = HSSFTestHelper.getEscherAggregate(patriarch);
    assertEquals(agg.getTailRecords().size(), 0);
    HSSFComment comment = patriarch.createCellComment(new HSSFClientAnchor());
    assertEquals(agg.getTailRecords().size(), 1);
    HSSFSimpleShape shape = patriarch.createSimpleShape(new HSSFClientAnchor());
    assertNotNull(shape);
    assertEquals(comment.getOptRecord().getEscherProperties().size(), 10);
    wb.close();
}
Also used : EscherAggregate(org.apache.poi.hssf.record.EscherAggregate) Test(org.junit.Test)

Example 27 with EscherAggregate

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

the class HSSFPicture method afterInsert.

@Override
void afterInsert(HSSFPatriarch patriarch) {
    EscherAggregate agg = patriarch.getBoundAggregate();
    agg.associateShapeToObjRecord(getEscherContainer().getChildById(EscherClientDataRecord.RECORD_ID), getObjRecord());
    if (getPictureIndex() != -1) {
        EscherBSERecord bse = patriarch.getSheet().getWorkbook().getWorkbook().getBSERecord(getPictureIndex());
        bse.setRef(bse.getRef() + 1);
    }
}
Also used : EscherAggregate(org.apache.poi.hssf.record.EscherAggregate) EscherBSERecord(org.apache.poi.ddf.EscherBSERecord)

Aggregations

EscherAggregate (org.apache.poi.hssf.record.EscherAggregate)27 Test (org.junit.Test)16 HSSFSheet (org.apache.poi.hssf.usermodel.HSSFSheet)13 HSSFWorkbook (org.apache.poi.hssf.usermodel.HSSFWorkbook)13 RecordBase (org.apache.poi.hssf.record.RecordBase)12 EscherContainerRecord (org.apache.poi.ddf.EscherContainerRecord)8 EscherRecord (org.apache.poi.ddf.EscherRecord)8 EscherDggRecord (org.apache.poi.ddf.EscherDggRecord)7 DrawingRecord (org.apache.poi.hssf.record.DrawingRecord)7 EOFRecord (org.apache.poi.hssf.record.EOFRecord)7 NoteRecord (org.apache.poi.hssf.record.NoteRecord)7 Record (org.apache.poi.hssf.record.Record)7 WindowTwoRecord (org.apache.poi.hssf.record.WindowTwoRecord)7 ContinueRecord (org.apache.poi.hssf.record.ContinueRecord)6 ObjRecord (org.apache.poi.hssf.record.ObjRecord)6 TextObjectRecord (org.apache.poi.hssf.record.TextObjectRecord)6 HSSFPatriarch (org.apache.poi.hssf.usermodel.HSSFPatriarch)5 EscherDgRecord (org.apache.poi.ddf.EscherDgRecord)3 RowRecordsAggregate (org.apache.poi.hssf.record.aggregates.RowRecordsAggregate)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2