def __init__(self, filename=None, content=NEWWORKBOOK): self.streams = {} self.sheets = RecordList(BoundSheet) self.fonts = RecordListRW(FontRecord) self.numberformats = RecordList(NumberFormat) self.extendedformats = RecordListRW(ExtendedFormat) self.staticstrings = StaticStrings() self.names = RecordList(NameRecord) self.supbooks = RecordList(SupBookRecord) if filename or content: self.read(filename, content)
def __init__(self, parent, data=NEW_WORKSHEET, ofs=0): self.columninfo = RecordList(ColumnInfo) self.parent = parent loaders = { 0x0006: self.add_cell, # Formula 0x007d: self.columninfo.read, 0x00bd: self.add_mulcell, # MulRKRecord 0x00be: self.add_mulcell, # MulBlankRecord 0x00fd: self.add_cell, #LabelSSTRecord 0x0200: self.add_dimensions, 0x0201: self.add_cell, #BlankRecord 0x0203: self.add_cell, #NumberRecord 0x0207: self.read_string, # StringRecord 0x0208: self.add_row, 0x027e: self.add_cell, #RKRecord 0x00d7: Record.ignore, # DBCell } urecord = {} self.rows = {} self.records = Record(0, 0) last_record = self.records for sid, data in record_stream(data): if sid == 0x000A: #EOF break new_record = loaders.get(sid, Record)(sid, data) if new_record: last_record.next = new_record last_record = new_record if sid not in urecord: urecord[sid] = new_record #if new_record.__class__==Record: # print '%04x(%08x): %s'%(sid,ofs,poi.utils.DEBUG_RECORDS.get(sid)) ofs += len(data) self.urecord = urecord