[Libreoffice-commits] .: src/xlsrecord.py src/xlsstream.py

Kohei Yoshida kohei at kemper.freedesktop.org
Wed May 18 15:41:36 PDT 2011


 src/xlsrecord.py |   19 +++++++++++++++++++
 src/xlsstream.py |    2 +-
 2 files changed, 20 insertions(+), 1 deletion(-)

New commits:
commit 09ea2720293df5ae85636d36a39d2e672567e798
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed May 18 18:38:21 2011 -0400

    Added handler for the HORIZONTALPAGEBREAKS record.
    
    This record stores all manually specified page breaks in a sheet.

diff --git a/src/xlsrecord.py b/src/xlsrecord.py
index 3704c8f..d029b43 100644
--- a/src/xlsrecord.py
+++ b/src/xlsrecord.py
@@ -974,6 +974,25 @@ class Formula(BaseRecordHandler):
         sheet.setCell(self.col, self.row, cell)
 
 
+class HorBreaks(BaseRecordHandler):
+    """Stores all horizontal breaks in a sheet."""
+
+    def __parseBytes (self):
+        self.count = self.readUnsignedInt(2)
+        self.breaks = []
+        for i in xrange(0, self.count):
+            row = self.readUnsignedInt(2)
+            col1 = self.readUnsignedInt(2)
+            col2 = self.readUnsignedInt(2)
+            self.breaks.append((row, col1, col2))
+
+    def parseBytes (self):
+        self.__parseBytes()
+        self.appendLine("count: %d"%self.count)
+        for i in xrange(0, self.count):
+            self.appendLine("break: (row: %d; colums: %d-%d)"%self.breaks[i])
+
+
 class Array(BaseRecordHandler):
 
     def __parseBytes (self):
diff --git a/src/xlsstream.py b/src/xlsstream.py
index d923bd9..ba71f7e 100644
--- a/src/xlsstream.py
+++ b/src/xlsstream.py
@@ -52,7 +52,7 @@ recData = {
     0x0019: ["WINDOWPROTECT", "Windows Are Protected"],
     0x0021: ["ARRAY", "Array-Entered Formula", xlsrecord.Array], # undocumented, but identical to 0x0221 ?
     0x001A: ["VERTICALPAGEBREAKS", "Explicit Column Page Breaks"],
-    0x001B: ["HORIZONTALPAGEBREAKS", "Explicit Row Page Breaks"],
+    0x001B: ["HORIZONTALPAGEBREAKS", "Explicit Row Page Breaks", xlsrecord.HorBreaks],
     0x001C: ["NOTE", "Comment Associated with a Cell"],
     0x001D: ["SELECTION", "Current Selection"],
     0x0022: ["DATEMODE", "Base Date for Displaying Date Values"],


More information about the Libreoffice-commits mailing list