From 71d45a05919029845fe0a20e36b8bddc9236f427 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Tue, 18 Mar 2014 11:18:30 +0100 Subject: implemented MergeCells --- msodumper/xlsrecord.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'msodumper/xlsrecord.py') diff --git a/msodumper/xlsrecord.py b/msodumper/xlsrecord.py index 1a0f336..e908067 100644 --- a/msodumper/xlsrecord.py +++ b/msodumper/xlsrecord.py @@ -15,6 +15,24 @@ class RecordError(Exception): pass # ------------------------------------------------------------------- # record handler classes +class Ref8(object): + + def __init__ (self, strm): + self.row1 = strm.readUnsignedInt(2) + self.row2 = strm.readUnsignedInt(2) + self.col1 = strm.readUnsignedInt(2) + self.col2 = strm.readUnsignedInt(2) + + def toString (self): + string = ("(col=%d,row=%d) - (col=%d,row=%d)"% + (self.col1, self.row1, self.col2, self.row2)) + if self.col1 == 0 and self.col2 == 0xFF: + string += ", entire column" + if self.row1 == 0 and self.row2 == 0xFFFF: + string += ", entire row" + return string + + class RefU(object): def __init__ (self, strm): @@ -3533,6 +3551,23 @@ class SXViewSource(BaseRecordHandler): self.appendLine("data source type: %s"%srcType) +class MergeCells(BaseRecordHandler): + + def __parseBytes (self): + self.cmcs = self.readUnsignedInt(2) + self.rgref = [] + for i in xrange(0, self.cmcs): + self.rgref.append(Ref8(self)) + + def parseBytes (self): + self.__parseBytes() + self.appendLine("%d merge ranges:"%self.cmcs) + i = 0 + for ref in self.rgref: + i += 1 + self.appendLine("%d: %s"%(i,ref.toString())) + + class Sxvd(BaseRecordHandler): def __parseBytes (self): -- cgit v1.2.3