public void TestCreateDgRecord() { EscherDgRecord dgRecord1 = drawingManager2.CreateDgRecord(); Assert.AreEqual(1, dgRecord1.DrawingGroupId); Assert.AreEqual(-1, dgRecord1.LastMSOSPID); EscherDgRecord dgRecord2 = drawingManager2.CreateDgRecord(); Assert.AreEqual(2, dgRecord2.DrawingGroupId); Assert.AreEqual(-1, dgRecord2.LastMSOSPID); Assert.AreEqual(2, dgg.DrawingsSaved); Assert.AreEqual(2, dgg.FileIdClusters.Length); Assert.AreEqual(3, dgg.NumIdClusters); Assert.AreEqual(0, dgg.NumShapesSaved); }
private void ConvertPatriarch(HSSFPatriarch patriarch) { EscherContainerRecord dgContainer = new EscherContainerRecord(); EscherDgRecord dg; EscherContainerRecord spgrContainer = new EscherContainerRecord(); EscherContainerRecord spContainer1 = new EscherContainerRecord(); EscherSpgrRecord spgr = new EscherSpgrRecord(); EscherSpRecord sp1 = new EscherSpRecord(); dgContainer.RecordId = EscherContainerRecord.DG_CONTAINER; dgContainer.Options = (short)0x000F; dg = drawingManager.CreateDgRecord(); drawingGroupId = dg.DrawingGroupId; // dg.Options( (short) ( drawingId << 4 ) ); // dg.NumShapes( GetNumberOfShapes( patriarch ) ); // dg.LastMSOSPID( 0 ); // populated after all shape id's are assigned. spgrContainer.RecordId = EscherContainerRecord.SPGR_CONTAINER; spgrContainer.Options = (short)0x000F; spContainer1.RecordId = EscherContainerRecord.SP_CONTAINER; spContainer1.Options = (short)0x000F; spgr.RecordId = EscherSpgrRecord.RECORD_ID; spgr.Options = (short)0x0001; // version spgr.RectX1 = patriarch.X1; spgr.RectY1 = patriarch.Y1; spgr.RectX2 = patriarch.X2; spgr.RectY2 = patriarch.Y2; sp1.RecordId = EscherSpRecord.RECORD_ID; sp1.Options = (short)0x0002; sp1.ShapeId = drawingManager.AllocateShapeId(dg.DrawingGroupId); sp1.Flags = EscherSpRecord.FLAG_GROUP | EscherSpRecord.FLAG_PATRIARCH; dgContainer.AddChildRecord(dg); dgContainer.AddChildRecord(spgrContainer); spgrContainer.AddChildRecord(spContainer1); spContainer1.AddChildRecord(spgr); spContainer1.AddChildRecord(sp1); AddEscherRecord(dgContainer); }