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)); }
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."); }
public object[] GetArguments() { return(XLSDescriptors.Parse(this.descriptor.BodyFormat, this.body, new XLSDescriptors.VariableArrayCountDelegate(this.GetVariableArraySize), new XLSDescriptors.StringLengthDelegate(this.GetStringLength))); }
public XLSRecord(int recordCode, int bodySize, BinaryReader br) { this.recordCode = recordCode; this.ReadBody(bodySize, br); this.descriptor = XLSDescriptors.GetByCode(recordCode); }
private void InitializeDescriptorCode(string name) { this.InitializeDescriptorCode(XLSDescriptors.GetByName(name)); }
protected void InitializeBody(object[] args) { this.InitializeBody(XLSDescriptors.Format(this.descriptor.BodyFormat, args)); }
public void WriteRecords(AbsXLSRecords destination, string recordName) { int code = XLSDescriptors.GetByName(recordName).Code; this.WriteRecords(destination, code); }
public void CopyRecords(PreservedRecords source, string recordName) { int code = XLSDescriptors.GetByName(recordName).Code; this.CopyRecords(source, code); }