Exemple #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));
        }
Exemple #2
0
        public static MsoContainerRecord CreateContainer(BinaryReader reader, MsoType type)
        {
            switch (type)
            {
            case MsoType.DggContainer:
                return(new MsoContainerRecord(XLSDescriptors.GetByName("MSOFBTDGGCONTAINER"), reader, type));

            case MsoType.BstoreContainer:
                return(new MsoContainerRecord(XLSDescriptors.GetByName("MSOFBTBSTORECONTAINER"), reader, type));

            case MsoType.DgContainer:
                return(new MsoContainerRecord(XLSDescriptors.GetByName("MSOFBTDGCONTAINER"), reader, type));

            case MsoType.SpgrContainer:
                return(new MsoContainerRecord(XLSDescriptors.GetByName("MSOFBTSPGRCONTAINER"), reader, type));

            case MsoType.SpContainer:
                return(new MsoContainerRecord(XLSDescriptors.GetByName("MSOFBTSPCONTAINER"), reader, type));
            }
            throw new ArgumentException("Unallowed mso type for recreation mso container.");
        }
Exemple #3
0
 public object[] GetArguments()
 {
     return(XLSDescriptors.Parse(this.descriptor.BodyFormat, this.body, new XLSDescriptors.VariableArrayCountDelegate(this.GetVariableArraySize), new XLSDescriptors.StringLengthDelegate(this.GetStringLength)));
 }
Exemple #4
0
 public XLSRecord(int recordCode, int bodySize, BinaryReader br)
 {
     this.recordCode = recordCode;
     this.ReadBody(bodySize, br);
     this.descriptor = XLSDescriptors.GetByCode(recordCode);
 }
Exemple #5
0
 private void InitializeDescriptorCode(string name)
 {
     this.InitializeDescriptorCode(XLSDescriptors.GetByName(name));
 }
Exemple #6
0
 protected void InitializeBody(object[] args)
 {
     this.InitializeBody(XLSDescriptors.Format(this.descriptor.BodyFormat, args));
 }
Exemple #7
0
        public void WriteRecords(AbsXLSRecords destination, string recordName)
        {
            int code = XLSDescriptors.GetByName(recordName).Code;

            this.WriteRecords(destination, code);
        }
Exemple #8
0
        public void CopyRecords(PreservedRecords source, string recordName)
        {
            int code = XLSDescriptors.GetByName(recordName).Code;

            this.CopyRecords(source, code);
        }