Beispiel #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));
        }
Beispiel #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);
 }
Beispiel #3
0
 public XLSRecord(int recordCode, int bodySize, BinaryReader br)
 {
     this.recordCode = recordCode;
     this.ReadBody(bodySize, br);
     this.descriptor = XLSDescriptors.GetByCode(recordCode);
 }
Beispiel #4
0
 protected XLSRecord(XLSDescriptor descriptor, int bodySize, BinaryReader br)
 {
     this.recordCode = descriptor.Code;
     this.ReadBody(bodySize, br);
     this.descriptor = descriptor;
 }
Beispiel #5
0
 protected XLSRecord(XLSDescriptor descriptor)
 {
     this.InitializeDescriptorCode(descriptor);
 }
Beispiel #6
0
 private void InitializeDescriptorCode(XLSDescriptor descriptor)
 {
     this.descriptor = descriptor;
     this.recordCode = this.descriptor.Code;
 }
Beispiel #7
0
 public MsoContainerRecord(XLSDescriptor descriptor, BinaryReader reader, MsoType type) : base(descriptor, reader, type)
 {
     this.items = new ArrayList();
     this.SetInstanceAndVersion(type);
 }
Beispiel #8
0
 public MsoContainerRecord(XLSDescriptor descriptor, MsoType type) : base(descriptor, type)
 {
     this.items = new ArrayList();
     this.SetInstanceAndVersion(type);
     base.InitializeBody((byte[])null);
 }
Beispiel #9
0
 public SSTRelated(XLSDescriptor descriptor) : base(descriptor)
 {
 }
Beispiel #10
0
 public SSTRelated(XLSDescriptor descriptor, int bodySize, BinaryReader br) : base(descriptor, bodySize, br)
 {
 }
Beispiel #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);
 }
Beispiel #12
0
 public MsoBaseRecord(XLSDescriptor descriptor, BinaryReader br, MsoType type) : base(descriptor, 0, br)
 {
     this.type = (ushort)type;
     this.Read(br);
 }
Beispiel #13
0
 public MsoBaseRecord(XLSDescriptor descriptor, MsoType type) : base(descriptor)
 {
     this.type = (ushort)type;
 }