Пример #1
0
        public void TestCreateProperties()
        {
            String dataStr = "41 C1 " +       // propid, complex ind
                             "03 00 00 00 " + // size of complex property
                             "01 00 " +       // propid, complex ind
                             "00 00 00 00 " + // value
                             "41 C1 " +       // propid, complex ind
                             "03 00 00 00 " + // size of complex property
                             "01 02 03 " +
                             "01 02 03 "
            ;

            byte[] data              = HexRead.ReadFromString(dataStr);
            EscherPropertyFactory f  = new EscherPropertyFactory();
            IList props              = f.CreateProperties(data, 0, (short)3);
            EscherComplexProperty p1 = (EscherComplexProperty)props[0];

            Assert.AreEqual(unchecked ((short)0xC141), p1.Id);
            Assert.AreEqual("[01, 02, 03, ]", HexDump.ToHex(p1.ComplexData));

            EscherComplexProperty p3 = (EscherComplexProperty)props[2];

            Assert.AreEqual(unchecked ((short)0xC141), p3.Id);
            Assert.AreEqual("[01, 02, 03, ]", HexDump.ToHex(p3.ComplexData));
        }
Пример #2
0
    public static ShapeGroup CreateShapeGroup(EscherContainerRecord spContainer, Shape parent){
        ShapeGroup group = null;
        EscherRecord opt = Shape.GetEscherChild((EscherContainerRecord)spContainer.GetChild(0), (short)0xF122);
        if(opt != null){
            try {
                EscherPropertyFactory f = new EscherPropertyFactory();
                List props = f.CreateProperties( opt.Serialize(), 8, opt.GetInstance() );
                EscherSimpleProperty p = (EscherSimpleProperty)props.Get(0);
                if(p.GetPropertyNumber() == 0x39F && p.GetPropertyValue() == 1){
                    group = new Table(spContainer, parent);
                } else {
                    group = new ShapeGroup(spContainer, parent);
                }
            } catch (Exception e){
                logger.log(POILogger.WARN, e.GetMessage());
                group = new ShapeGroup(spContainer, parent);
            }
        }  else {
            group = new ShapeGroup(spContainer, parent);
        }

        return group;
     }