Ejemplo n.º 1
0
        public static AbsXLSRec Read(BinaryReader br, AbsXLSRec previousRecord, IoOperationInfo operationInfo)
        {
            int code = br.ReadUInt16();

            if (code == 0)
            {
                return(null);
            }
            int           size   = br.ReadUInt16();
            XLSDescriptor byCode = XLSDescriptors.GetByCode(code);

            if (!XLSDescriptors.ValidBodySize(byCode, size, false))
            {
                byCode = null;
            }
            if ((byCode != null) && (byCode.Name == "FILEPASS"))
            {
                throw new Exception("Current version of ebexcel can't read encrypted workbooks. You can use only simple password protection against modifying (set in MS Excel 'Save As' dialog).");
            }
            if ((byCode != null) && (byCode.HandlerClass != typeof(XLSRecord)))
            {
                return((AbsXLSRec)Activator.CreateInstance(byCode.HandlerClass, new object[] { size, br, previousRecord, operationInfo }));
            }
            return(new XLSRecord(code, size, br));
        }
Ejemplo n.º 2
0
 public static bool ValidBodySize(XLSDescriptor des, int size, bool exception)
 {
     if (((des != null) && des.IsFixedSize) && (des.BodySize != size))
     {
         if (des.Code == 430)
         {
             throw new Exception("External references are currently not supported.");
         }
         string str = string.Concat(new object[] { "Record should have size ", des.BodySize, " and not ", size, "." });
         if (exception)
         {
             throw new Exception("Internal error: " + str);
         }
         return(false);
     }
     return(true);
 }
Ejemplo n.º 3
0
 public XLSRecord(int recordCode, int bodySize, BinaryReader br)
 {
     this.recordCode = recordCode;
     this.ReadBody(bodySize, br);
     this.descriptor = XLSDescriptors.GetByCode(recordCode);
 }
Ejemplo n.º 4
0
 protected XLSRecord(XLSDescriptor descriptor, int bodySize, BinaryReader br)
 {
     this.recordCode = descriptor.Code;
     this.ReadBody(bodySize, br);
     this.descriptor = descriptor;
 }
Ejemplo n.º 5
0
 protected XLSRecord(XLSDescriptor descriptor)
 {
     this.InitializeDescriptorCode(descriptor);
 }
Ejemplo n.º 6
0
 private void InitializeDescriptorCode(XLSDescriptor descriptor)
 {
     this.descriptor = descriptor;
     this.recordCode = this.descriptor.Code;
 }
Ejemplo n.º 7
0
 public MsoContainerRecord(XLSDescriptor descriptor, BinaryReader reader, MsoType type) : base(descriptor, reader, type)
 {
     this.items = new ArrayList();
     this.SetInstanceAndVersion(type);
 }
Ejemplo n.º 8
0
 public MsoContainerRecord(XLSDescriptor descriptor, MsoType type) : base(descriptor, type)
 {
     this.items = new ArrayList();
     this.SetInstanceAndVersion(type);
     base.InitializeBody((byte[])null);
 }
Ejemplo n.º 9
0
 public SSTRelated(XLSDescriptor descriptor) : base(descriptor)
 {
 }
Ejemplo n.º 10
0
 public SSTRelated(XLSDescriptor descriptor, int bodySize, BinaryReader br) : base(descriptor, bodySize, br)
 {
 }
Ejemplo n.º 11
0
 public MsoBaseRecord(XLSDescriptor descriptor, int bodyLength, BinaryReader br, MsoType type, IoOperationInfo operationInfo) : base(descriptor, bodyLength, br)
 {
     this.type          = (ushort)type;
     this.operationInfo = operationInfo;
     this.Read(br);
 }
Ejemplo n.º 12
0
 public MsoBaseRecord(XLSDescriptor descriptor, BinaryReader br, MsoType type) : base(descriptor, 0, br)
 {
     this.type = (ushort)type;
     this.Read(br);
 }
Ejemplo n.º 13
0
 public MsoBaseRecord(XLSDescriptor descriptor, MsoType type) : base(descriptor)
 {
     this.type = (ushort)type;
 }