[Libreoffice-commits] mso-dumper.git: msodumper/xlsrecord.py msodumper/xlsstream.py

Eike Rathke erack at redhat.com
Mon Mar 17 15:18:41 PDT 2014


 msodumper/xlsrecord.py |   51 ++++++++++++++++++++++++++++++++++++++++++++++++-
 msodumper/xlsstream.py |   21 ++++++++++++++++++--
 2 files changed, 69 insertions(+), 3 deletions(-)

New commits:
commit f0e8c8fea614960d28cc2e52fd32d02dbdebd01f
Author: Eike Rathke <erack at redhat.com>
Date:   Mon Mar 17 23:06:02 2014 +0100

    added some record IDs and implemented FeatureData for 0x0868 FEAT
    
    FEAT actually is a collection of records of which FEATHDR specifies the
    common data, for example enhanced protection. FEAT contains sequences of
    ranges the feature is applied to.
    
    Also, FEAT was wrongly named RANGEPROTECTION (probably from the OOo
    documentation).
    
    Added names of IDs in the range 0x086? to 0x088?
    
    See
    http://msdn.microsoft.com/en-us/library/dd945945.aspx
    http://msdn.microsoft.com/en-us/library/dd907085.aspx
    http://msdn.microsoft.com/en-us/library/dd911261.aspx

diff --git a/msodumper/xlsrecord.py b/msodumper/xlsrecord.py
index 9a51fc7..b3cbece 100644
--- a/msodumper/xlsrecord.py
+++ b/msodumper/xlsrecord.py
@@ -2636,6 +2636,8 @@ class FeatureHeader(BaseRecordHandler):
         featureTypeText = 'unknown'
         if featureTypeId == 2:
             featureTypeText = 'enhanced protection'
+        elif featureTypeId == 3:
+            featureTypeText = 'ignored formula errors'
         elif featureTypeId == 4:
             featureTypeText = 'smart tag'
         featureHdr = self.readUnsignedInt(1) # must be 1
@@ -2649,7 +2651,7 @@ class FeatureHeader(BaseRecordHandler):
         self.appendLine("size of header data: %d (%s)"%(sizeHdrData, sizeHdrDataText))
 
         if featureTypeId == 2 and sizeHdrData == -1:
-            # enhanced protection optionsss
+            # enhanced protection options
             flags = self.readUnsignedInt(4)
             self.appendLine("enhanced protection flag: 0x%8.8X"%flags)
 
@@ -2686,6 +2688,53 @@ class FeatureHeader(BaseRecordHandler):
 
         return
 
+class FeatureData(BaseRecordHandler):
+
+    def parseBytes (self):
+        recordType = self.readUnsignedInt(2)
+        frtFlag = self.readUnsignedInt(2) # currently 0
+        self.readBytes(8) # reserved (currently all 0)
+        featureTypeId = self.readUnsignedInt(2)
+        featureTypeText = 'unknown'
+        if featureTypeId == 2:
+            featureTypeText = 'enhanced protection'
+        elif featureTypeId == 3:
+            featureTypeText = 'ignored formula errors'
+        elif featureTypeId == 4:
+            featureTypeText = 'smart tag'
+        self.readBytes(1) # reserved1, must be 0
+        self.readBytes(4) # reserved2, must be 0
+        cref = self.readUnsignedInt(2)
+        cbFeatData = self.readUnsignedInt(4)
+        cbFeatDataText = 'byte size'
+        self.readBytes(2) # reserved3, must be 0
+
+        refs = []
+        for i in xrange(0, cref):
+            refs.append(Ref8U(self))
+
+        self.appendLine("record type: 0x%4.4X (must match the header)"%recordType)
+        self.appendLine("feature type: %d (%s)"%(featureTypeId, featureTypeText))
+        self.appendLine("size of feature data: %d (%s)"%(cbFeatData, cbFeatDataText))
+
+        # http://msdn.microsoft.com/en-us/library/dd911261.aspx
+        # Documentation isn't very clear on this, for cbFeatData it says must
+        # be 0 if 'isf' (featureTypeId) is not ISFFEC2 (type 3) but for rgbFeat
+        # (the variable data field) lists structures for each of the possible
+        # types. However, so far there was no FeatProtection structure data for
+        # ISFPROTECTION encountered.
+
+        if featureTypeId == 3 and cbFeatData > 0:
+            # ignored formula errors, ISFFEC2, FeatFormulaErr2 structure
+            self.readBytes(cbFeatData)
+            self.appendLine("FeatFormulaErr2 yet not handled")
+
+        for ref in refs:
+            self.appendLine("applied to range: (col=%d,row=%d) - (col=%d,row=%d)"%
+                (ref.col1, ref.row1, ref.col2, ref.row2))
+
+        return
+
 class ShrFmla(BaseRecordHandler):
 
     def __parseBytes (self):
diff --git a/msodumper/xlsstream.py b/msodumper/xlsstream.py
index 945c5a8..0f514ee 100644
--- a/msodumper/xlsstream.py
+++ b/msodumper/xlsstream.py
@@ -143,6 +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"],
     0x00EA: ["TABIDCONF", "Sheet Tab ID of Conflict History"],
     0x00EB: ["MSODRAWINGGROUP", "Microsoft Office Drawing Group", xlsrecord.MSODrawingGroup],
     0x00EC: ["MSODRAWING", "Microsoft Office Drawing", xlsrecord.MSODrawing],
@@ -215,10 +216,26 @@ recData = {
     0x0862: ["SHEETLAYOUT", "Tab Color below Sheet Name"],
     0x0863: ["BOOKEXT", "Extra Book Info"],
     0x0864: ["SXADDL", "Pivot Table Additional Info", xlsrecord.SXAddlInfo],
-    0x0867: ["FEATHEADR", "Shared Feature Header", xlsrecord.FeatureHeader],
-    0x0868: ["RANGEPROTECTION", "Protected Range on Protected Sheet"],
+    0x0867: ["FEATHDR", "Shared Feature Header, specifies the beginning of a collection of records", xlsrecord.FeatureHeader],
+    0x0868: ["FEAT", "Shared Feature Data (wrongly named RANGEPROTECTION elsewhere)", xlsrecord.FeatureData],
+    0x086A: ["DATALABEXT", "Extended Data Label"],
     0x086B: ["DATALABEXTCONTENTS", "Contents of an extended data label", xlsrecord.DataLabExtContents],
+    0x086C: ["CELLWATCH", "Reference to a watched cell"],
+    0x0871: ["FEATHDR11", "Common information for all tables on a sheet and specifies the beginning of a collection"],
+    0x0872: ["FEATURE11", "Shared feature data. The only shared feature type stored in this record is a table in a worksheet."],
+    0x0873: ["DROPDOWNOBJIDS", "Object identifiers that can be reused by the application when creating the dropdown objects for the AutoFilter at runtime in a sheet"],
+    0x0875: ["CONTINUEFRT11", "Continuation of the data in a preceding Future Record Type record that has data longer than 8,224 bytes"],
+    0x0876: ["DCONN", "Information for a single data connection"],
+    0x0877: ["LIST12", "Additional formatting information for a table"],
+    0x0878: ["FEATURE12", "Shared feature data that is used to describe a table in a worksheet"],
+    0x0879: ["CONDFMT12", "Conditional formatting rules that are associated with a set of cells, when all the rules are specified using CF12 records"],
+    0x087A: ["CF12", "Conditional formatting rule"],
+    0x087B: ["CFEX", "Extends a CondFmt"],
+    0x087C: ["XFCRC", "Number of XF records contained in this file and that contains a checksum of the data in those records"],
     0x087D: ["XFEXT", "XF Extension"],
+    0x087E: ["AUTOFILTER12", "AutoFilter properties"],
+    0x087F: ["CONTINUEFRT12", "Continuation of the data in a preceding Future Record Type record that has data longer than 8,224 bytes"],
+    0x088B: ["PLV", "Page Layout view for a sheet"],
     0x088C: ["COMPAT12", "Compatibility Checker 12"],
     0x088E: ["TABLESTYLES", "Table Styles"],
     0x0892: ["STYLEEXT", "Named Cell Style Extension"],


More information about the Libreoffice-commits mailing list