Ejemplo n.º 1
0
        private void ConvertUserModelToRecords()
        {
            if (patriarch != null)
            {
                shapeToObj.Clear();
                tailRec.Clear();
                ClearEscherRecords();
                if (patriarch.Children.Count != 0)
                {
                    ConvertPatriarch(patriarch);
                    EscherContainerRecord dgContainer = (EscherContainerRecord)GetEscherRecord(0);
                    EscherContainerRecord spgrContainer = null;
                    for (int i = 0; i < dgContainer.ChildRecords.Count; i++)
                        if (dgContainer.GetChild(i).RecordId == EscherContainerRecord.SPGR_CONTAINER)
                            spgrContainer = (EscherContainerRecord)dgContainer.GetChild(i);
                    ConvertShapes(patriarch, spgrContainer, shapeToObj);

                    patriarch = null;
                }
            }
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates the top-level drawing patriarch.  This will have
        /// the effect of removing any existing drawings on this
        /// _sheet.
        /// This may then be used to Add graphics or charts
        /// </summary>
        /// <returns>The new patriarch.</returns>
        public LF.Utils.NPOI.SS.UserModel.IDrawing CreateDrawingPatriarch()
        {
            if (_patriarch == null)
            {
                // Create the drawing group if it doesn't already exist.
                _workbook.InitDrawings();

                if (_patriarch == null)
                {
                    _sheet.AggregateDrawingRecords(book.DrawingManager, true);
                    EscherAggregate agg = (EscherAggregate)_sheet.FindFirstRecordBySid(EscherAggregate.sid);
                    _patriarch = new HSSFPatriarch(this, agg);
                    agg.Patriarch=(_patriarch);
                }
            }
            return _patriarch;
        }