当前位置: 首页>>代码示例>>C#>>正文


C# EscherContainerRecord.FillFields方法代码示例

本文整理汇总了C#中NPOI.DDF.EscherContainerRecord.FillFields方法的典型用法代码示例。如果您正苦于以下问题:C# EscherContainerRecord.FillFields方法的具体用法?C# EscherContainerRecord.FillFields怎么用?C# EscherContainerRecord.FillFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NPOI.DDF.EscherContainerRecord的用法示例。


在下文中一共展示了EscherContainerRecord.FillFields方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestReadPNG

        public void TestReadPNG()
        {
            //provided in bug-44886
            byte[] data = _samples.ReadFile("Container.dat");

            EscherContainerRecord record = new EscherContainerRecord();
            record.FillFields(data, 0, new DefaultEscherRecordFactory());
            EscherContainerRecord bstore = (EscherContainerRecord)record.ChildRecords[1];
            EscherBSERecord bse1 = (EscherBSERecord)bstore.ChildRecords[0];
            Assert.AreEqual(EscherBSERecord.BT_PNG, bse1.BlipTypeWin32);
            Assert.AreEqual(EscherBSERecord.BT_PNG, bse1.BlipTypeMacOS);
            Assert.IsTrue(Arrays.Equals(new byte[]{
            0x65, 0x07, 0x4A, (byte)0x8D, 0x3E, 0x42, (byte)0x8B, (byte)0xAC,
            0x1D, (byte)0x89, 0x35, 0x4F, 0x48, (byte)0xFA, 0x37, (byte)0xC2
        }, bse1.UID));
            Assert.AreEqual(255, bse1.Tag);
            Assert.AreEqual(32308, bse1.Size);

            EscherBitmapBlip blip1 = (EscherBitmapBlip)bse1.BlipRecord;
            Assert.AreEqual(0x6E00, blip1.Options);
            Assert.AreEqual(EscherBitmapBlip.RECORD_ID_PNG, blip1.RecordId);
            Assert.IsTrue(Arrays.Equals(new byte[]{
            0x65, 0x07, 0x4A, (byte)0x8D, 0x3E, 0x42, (byte)0x8B, (byte)0xAC,
            0x1D, (byte)0x89, 0x35, 0x4F, 0x48, (byte)0xFA, 0x37, (byte)0xC2
        }, blip1.UID));

            //Serialize and Read again
            byte[] ser = bse1.Serialize();
            EscherBSERecord bse2 = new EscherBSERecord();
            bse2.FillFields(ser, 0, new DefaultEscherRecordFactory());
            Assert.AreEqual(bse1.RecordId, bse2.RecordId);
            Assert.AreEqual(bse1.BlipTypeWin32, bse2.BlipTypeWin32);
            Assert.AreEqual(bse1.BlipTypeMacOS, bse2.BlipTypeMacOS);
            Assert.IsTrue(Arrays.Equals(bse1.UID, bse2.UID));
            Assert.AreEqual(bse1.Tag, bse2.Tag);
            Assert.AreEqual(bse1.Size, bse2.Size);

            EscherBitmapBlip blip2 = (EscherBitmapBlip)bse1.BlipRecord;
            Assert.AreEqual(blip1.Options, blip2.Options);
            Assert.AreEqual(blip1.RecordId, blip2.RecordId);
            Assert.AreEqual(blip1.UID, blip2.UID);

            Assert.IsTrue(Arrays.Equals(blip1.PictureData, blip1.PictureData));
        }
开发者ID:ctddjyds,项目名称:npoi,代码行数:44,代码来源:TestEscherBlipRecord.cs

示例2: CloneShape

 internal override HSSFShape CloneShape()
 {
     TextObjectRecord txo = (TextObjectRecord)GetTextObjectRecord().CloneViaReserialise();
     EscherContainerRecord spContainer = new EscherContainerRecord();
     byte[] inSp = GetEscherContainer().Serialize();
     spContainer.FillFields(inSp, 0, new DefaultEscherRecordFactory());
     ObjRecord obj = (ObjRecord)GetObjRecord().CloneViaReserialise();
     NoteRecord note = (NoteRecord)NoteRecord.CloneViaReserialise();
     return new HSSFComment(spContainer, obj, txo, note);
 }
开发者ID:WPG,项目名称:npoi,代码行数:10,代码来源:HSSFComment.cs

示例3: CloneShape

 internal override HSSFShape CloneShape()
 {
     TextObjectRecord txo = GetTextObjectRecord() == null ? null : (TextObjectRecord)GetTextObjectRecord().CloneViaReserialise();
     EscherContainerRecord spContainer = new EscherContainerRecord();
     byte[] inSp = GetEscherContainer().Serialize();
     spContainer.FillFields(inSp, 0, new DefaultEscherRecordFactory());
     ObjRecord obj = (ObjRecord)GetObjRecord().CloneViaReserialise();
     return new HSSFTextbox(spContainer, obj, txo);
 }
开发者ID:WPG,项目名称:npoi,代码行数:9,代码来源:HSSFTextbox.cs

示例4: CloneShape

 internal override HSSFShape CloneShape()
 {
     TextObjectRecord txo = null;
     EscherContainerRecord spContainer = new EscherContainerRecord();
     byte[] inSp = GetEscherContainer().Serialize();
     spContainer.FillFields(inSp, 0, new DefaultEscherRecordFactory());
     ObjRecord obj = (ObjRecord)GetObjRecord().CloneViaReserialise();
     if (GetTextObjectRecord() != null && this.String != null && null != this.String.String)
     {
         txo = (TextObjectRecord)GetTextObjectRecord().CloneViaReserialise();
     }
     return new HSSFSimpleShape(spContainer, obj, txo);
 }
开发者ID:Ni9e,项目名称:npoi,代码行数:13,代码来源:HSSFSimpleShape.cs

示例5: TestBug44857

        public void TestBug44857()
        {
            //File f = new File(ESCHER_DATA_PATH, "Container.dat");
            Assert.IsTrue(File.Exists(ESCHER_DATA_PATH+"Container.dat"));

            using (FileStream finp = new FileStream(ESCHER_DATA_PATH + "Container.dat", FileMode.Open, FileAccess.Read))
            {
                byte[] data = IOUtils.ToByteArray(finp);
                finp.Close();

                // This used to fail with an OutOfMemory
                EscherContainerRecord record = new EscherContainerRecord();
                record.FillFields(data, 0, new DefaultEscherRecordFactory());
            }
        }
开发者ID:Reinakumiko,项目名称:npoi,代码行数:15,代码来源:TestEscherContainerRecord.cs

示例6: CloneShape

 internal override HSSFShape CloneShape()
 {
     EscherContainerRecord spContainer = new EscherContainerRecord();
     byte[] inSp = GetEscherContainer().Serialize();
     spContainer.FillFields(inSp, 0, new DefaultEscherRecordFactory());
     ObjRecord obj = (ObjRecord)GetObjRecord().CloneViaReserialise();
     return new HSSFPicture(spContainer, obj);
 }
开发者ID:WPG,项目名称:npoi,代码行数:8,代码来源:HSSFPicture.cs

示例7: CloneShape

        internal HSSFShape CloneShape(HSSFPatriarch patriarch)
        {
            EscherContainerRecord spgrContainer = new EscherContainerRecord();
            spgrContainer.RecordId = (EscherContainerRecord.SPGR_CONTAINER);
            spgrContainer.Options = ((short)0x000F);
            EscherContainerRecord spContainer = new EscherContainerRecord();
            EscherContainerRecord cont = (EscherContainerRecord)GetEscherContainer().GetChildById(EscherContainerRecord.SP_CONTAINER);
            byte[] inSp = cont.Serialize();
            spContainer.FillFields(inSp, 0, new DefaultEscherRecordFactory());

            spgrContainer.AddChildRecord(spContainer);
            ObjRecord obj = null;
            if (null != this.GetObjRecord())
            {
                obj = (ObjRecord)this.GetObjRecord().CloneViaReserialise();
            }

            HSSFShapeGroup group = new HSSFShapeGroup(spgrContainer, obj);
            group.Patriarch = patriarch;

            foreach (HSSFShape shape in Children)
            {
                HSSFShape newShape;
                if (shape is HSSFShapeGroup)
                {
                    newShape = ((HSSFShapeGroup)shape).CloneShape(patriarch);
                }
                else
                {
                    newShape = shape.CloneShape();
                }
                group.AddShape(newShape);
                group.OnCreate(newShape);
            }
            return group;
        }
开发者ID:WPG,项目名称:npoi,代码行数:36,代码来源:HSSFShapeGroup.cs

示例8: TestReadPICT

        public void TestReadPICT()
        {
            //provided in bug-44886
            byte[] data = _samples.ReadFile("Container.dat");

            EscherContainerRecord record = new EscherContainerRecord();
            record.FillFields(data, 0, new DefaultEscherRecordFactory());
            EscherContainerRecord bstore = (EscherContainerRecord)record.ChildRecords[1];
            EscherBSERecord bse1 = (EscherBSERecord)bstore.ChildRecords[1];
            //System.out.println(bse1);
            Assert.AreEqual(EscherBSERecord.BT_WMF, bse1.BlipTypeWin32);
            Assert.AreEqual(EscherBSERecord.BT_PICT, bse1.BlipTypeMacOS);
            Assert.IsTrue(Arrays.Equals(new byte[]{
            (byte)0xC7, 0x15, 0x69, 0x2D, (byte)0xE5, (byte)0x89, (byte)0xA3, 0x6F,
            0x66, 0x03, (byte)0xD6, 0x24, (byte)0xF7, (byte)0xDB, 0x1D, 0x13
        }, bse1.UID));
            Assert.AreEqual(255, bse1.Tag);
            Assert.AreEqual(1133, bse1.Size);

            EscherMetafileBlip blip1 = (EscherMetafileBlip)bse1.BlipRecord;
            Assert.AreEqual(0x5430, blip1.Options);
            Assert.AreEqual(EscherMetafileBlip.RECORD_ID_PICT, blip1.RecordId);
            Assert.IsTrue(Arrays.Equals(new byte[]{
            0x57, 0x32, 0x7B, (byte)0x91, 0x23, 0x5D, (byte)0xDB, 0x36,
            0x7A, (byte)0xDB, (byte)0xFF, 0x17, (byte)0xFE, (byte)0xF3, (byte)0xA7, 0x05
        }, blip1.UID));
            Assert.IsTrue(Arrays.Equals(new byte[]{
            (byte)0xC7, 0x15, 0x69, 0x2D, (byte)0xE5, (byte)0x89, (byte)0xA3, 0x6F,
            0x66, 0x03, (byte)0xD6, 0x24, (byte)0xF7, (byte)0xDB, 0x1D, 0x13
        }, blip1.PrimaryUID));

            //Serialize and Read again
            byte[] ser = bse1.Serialize();
            EscherBSERecord bse2 = new EscherBSERecord();
            bse2.FillFields(ser, 0, new DefaultEscherRecordFactory());
            Assert.AreEqual(bse1.RecordId, bse2.RecordId);
            Assert.AreEqual(bse1.Options, bse2.Options);
            Assert.AreEqual(bse1.BlipTypeWin32, bse2.BlipTypeWin32);
            Assert.AreEqual(bse1.BlipTypeMacOS, bse2.BlipTypeMacOS);
            Assert.IsTrue(Arrays.Equals(bse1.UID, bse2.UID));
            Assert.AreEqual(bse1.Tag, bse2.Tag);
            Assert.AreEqual(bse1.Size, bse2.Size);

            EscherMetafileBlip blip2 = (EscherMetafileBlip)bse1.BlipRecord;
            Assert.AreEqual(blip1.Options, blip2.Options);
            Assert.AreEqual(blip1.RecordId, blip2.RecordId);
            Assert.AreEqual(blip1.UID, blip2.UID);
            Assert.AreEqual(blip1.PrimaryUID, blip2.PrimaryUID);

            Assert.IsTrue(Arrays.Equals(blip1.PictureData, blip1.PictureData));
        }
开发者ID:ctddjyds,项目名称:npoi,代码行数:51,代码来源:TestEscherBlipRecord.cs

示例9: TestContainer

        public void TestContainer()
        {
            byte[] data = _samples.ReadFile("Container.dat");

            EscherContainerRecord record = new EscherContainerRecord();
            record.FillFields(data, 0, new DefaultEscherRecordFactory());

            byte[] ser = record.Serialize();
            Assert.IsTrue(Arrays.Equals(data, ser));
        }
开发者ID:ctddjyds,项目名称:npoi,代码行数:10,代码来源:TestEscherBlipRecord.cs


注:本文中的NPOI.DDF.EscherContainerRecord.FillFields方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。