[Libreoffice-commits] mso-dumper.git: msodumper/xlsrecord.py msodumper/xlsstream.py
Eike Rathke
erack at redhat.com
Tue Mar 18 03:19:09 PDT 2014
msodumper/xlsrecord.py | 35 +++++++++++++++++++++++++++++++++++
msodumper/xlsstream.py | 2 +-
2 files changed, 36 insertions(+), 1 deletion(-)
New commits:
commit 71d45a05919029845fe0a20e36b8bddc9236f427
Author: Eike Rathke <erack at redhat.com>
Date: Tue Mar 18 11:18:30 2014 +0100
implemented MergeCells
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):
diff --git a/msodumper/xlsstream.py b/msodumper/xlsstream.py
index 0f514ee..a034a4c 100644
--- a/msodumper/xlsstream.py
+++ b/msodumper/xlsstream.py
@@ -143,7 +143,7 @@ recData = {
0x00E1: ["INTERFACEHDR", "Beginning of User Interface Records"],
0x00E2: ["INTERFACEEND", "End of User Interface Records"],
0x00E3: ["SXVS", "PivotCache Source Data Type", xlsrecord.SXViewSource],
- 0x00E5: ["MERGECELLS", "Merged cells in the document"],
+ 0x00E5: ["MERGECELLS", "Merged cells in the document", xlsrecord.MergeCells],
0x00EA: ["TABIDCONF", "Sheet Tab ID of Conflict History"],
0x00EB: ["MSODRAWINGGROUP", "Microsoft Office Drawing Group", xlsrecord.MSODrawingGroup],
0x00EC: ["MSODRAWING", "Microsoft Office Drawing", xlsrecord.MSODrawing],
More information about the Libreoffice-commits
mailing list