ooo-build r15315 - in trunk: . scratch/mso-dumper/src
- From: kyoshida svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r15315 - in trunk: . scratch/mso-dumper/src
- Date: Tue, 10 Feb 2009 17:40:37 +0000 (UTC)
Author: kyoshida
Date: Tue Feb 10 17:40:37 2009
New Revision: 15315
URL: http://svn.gnome.org/viewvc/ooo-build?rev=15315&view=rev
Log:
2009-02-10 Kohei Yoshida <kyoshida novell com>
* scratch/mso-dumper/src/xlsrecord.py:
* scratch/mso-dumper/src/xlsstream.py: added handlers for several
records & more record IDs added.
Modified:
trunk/ChangeLog
trunk/scratch/mso-dumper/src/xlsrecord.py
trunk/scratch/mso-dumper/src/xlsstream.py
Modified: trunk/scratch/mso-dumper/src/xlsrecord.py
==============================================================================
--- trunk/scratch/mso-dumper/src/xlsrecord.py (original)
+++ trunk/scratch/mso-dumper/src/xlsrecord.py Tue Feb 10 17:40:37 2009
@@ -38,6 +38,10 @@
text = "%s: %s"%(name, self.getYesNo(value))
self.appendLine(text)
+ def appendCellPosition (self, col, row):
+ text = "cell position: (col: %d; row: %d)"%(col, row)
+ self.appendLine(text)
+
def readBytes (self, length):
r = self.bytes[self.pos:self.pos+length]
self.pos += length
@@ -181,6 +185,20 @@
self.appendLine("sheet type: %s"%BoundSheet.getSheetType(sheetType))
+class Dimensions(BaseRecordHandler):
+
+ def parseBytes (self):
+ rowMic = self.readUnsignedInt(4)
+ rowMac = self.readUnsignedInt(4)
+ colMic = self.readUnsignedInt(2)
+ colMac = self.readUnsignedInt(2)
+
+ self.appendLine("first defined row: %d"%rowMic)
+ self.appendLine("last defined row plus 1: %d"%rowMac)
+ self.appendLine("first defined column: %d"%colMic)
+ self.appendLine("last defined column plus 1: %d"%colMac)
+
+
class Formula(BaseRecordHandler):
def parseBytes (self):
@@ -199,7 +217,7 @@
fparser.parse()
ftext = fparser.getText()
- self.appendLine("cell position: (col: %d; row: %d)"%(col, row))
+ self.appendCellPosition(col, row)
self.appendLine("XF record ID: %d"%xf)
self.appendLine("formula result: %g"%fval)
self.appendLine("recalculate always: %d"%recalc)
@@ -209,6 +227,19 @@
self.appendLine("tokens: "+ftext)
+class Label(BaseRecordHandler):
+
+ def parseBytes (self):
+ col = self.readUnsignedInt(2)
+ row = self.readUnsignedInt(2)
+ xfIdx = self.readUnsignedInt(2)
+ textLen = self.readUnsignedInt(2)
+ text, textLen = globals.getRichText(self.readRemainingBytes(), textLen)
+ self.appendCellPosition(col, row)
+ self.appendLine("XF record ID: %d"%xfIdx)
+ self.appendLine("label text: %s"%text)
+
+
class Number(BaseRecordHandler):
def parseBytes (self):
@@ -216,7 +247,7 @@
col = globals.getSignedInt(self.bytes[2:4])
xf = globals.getSignedInt(self.bytes[4:6])
fval = globals.getDouble(self.bytes[6:14])
- self.appendLine("cell position: (col: %d; row: %d)"%(col, row))
+ self.appendCellPosition(col, row)
self.appendLine("XF record ID: %d"%xf)
self.appendLine("value: %g"%fval)
@@ -248,7 +279,7 @@
if multi100:
realVal /= 100
- self.appendLine("cell position: (col: %d; row: %d)"%(col, row))
+ self.appendCellPosition(col, row)
self.appendLine("XF record ID: %d"%xf)
self.appendLine("multiplied by 100: %d"%multi100)
if signedInt:
@@ -273,7 +304,7 @@
row = globals.getSignedInt(self.bytes[0:2])
col = globals.getSignedInt(self.bytes[2:4])
xf = globals.getSignedInt(self.bytes[4:6])
- self.appendLine("cell position: (col: %d; row: %d)"%(col, row))
+ self.appendCellPosition(col, row)
self.appendLine("XF record ID: %d"%xf)
@@ -1362,6 +1393,38 @@
self.appendLine("size: (width, height) = (%d, %d)"%(w, h))
+class CHSeries(BaseRecordHandler):
+
+ DATE = 0
+ NUMERIC = 1
+ SEQUENCE = 2
+ TEXT = 3
+
+ seriesTypes = ['date', 'numeric', 'sequence', 'text']
+
+ @staticmethod
+ def getSeriesType (idx):
+ r = 'unknown'
+ if idx < len(CHSeries.seriesTypes):
+ r = CHSeries.seriesTypes[idx]
+ return r
+
+ def parseBytes (self):
+ catType = self.readUnsignedInt(2)
+ valType = self.readUnsignedInt(2)
+ catCount = self.readUnsignedInt(2)
+ valCount = self.readUnsignedInt(2)
+ bubbleType = self.readUnsignedInt(2)
+ bubbleCount = self.readUnsignedInt(2)
+
+ self.appendLine("category type: %s (count: %d)"%
+ (CHSeries.getSeriesType(catType), catCount))
+ self.appendLine("value type: %s (count: %d)"%
+ (CHSeries.getSeriesType(valType), valCount))
+ self.appendLine("bubble type: %s (count: %d)"%
+ (CHSeries.getSeriesType(bubbleType), bubbleCount))
+
+
class CHAxis(BaseRecordHandler):
axisTypeList = ['x-axis', 'y-axis', 'z-axis']
Modified: trunk/scratch/mso-dumper/src/xlsstream.py
==============================================================================
--- trunk/scratch/mso-dumper/src/xlsstream.py (original)
+++ trunk/scratch/mso-dumper/src/xlsstream.py Tue Feb 10 17:40:37 2009
@@ -172,10 +172,10 @@
0x01BE: ["DV", "Data Validation Criteria"],
0x01C0: ["EXCEL9FILE", "Excel 9 File"],
0X01C1: ["RECALCID", "Recalc Information"],
- 0x0200: ["DIMENSIONS", "Cell Table Size"],
+ 0x0200: ["DIMENSIONS", "Cell Table Size", xlsrecord.Dimensions],
0x0201: ["BLANK", "Blank Cell", xlsrecord.Blank],
0x0203: ["NUMBER", "Floating-Point Cell Value", xlsrecord.Number],
- 0x0204: ["LABEL", "Cell Value"],
+ 0x0204: ["LABEL", "Cell Value", xlsrecord.Label],
0x0205: ["BOOLERR", "Cell Value"],
0x0207: ["STRING", "String Value of a Formula", xlsrecord.String],
0x0208: ["ROW", "Describes a Row", xlsrecord.Row],
@@ -201,7 +201,7 @@
0x0868: ["RANGEPROTECTION", "Protected Range on Protected Sheet"],
0x1001: ["CHUNITS", "?"],
0x1002: ["CHCHART", "Chart Header Data", xlsrecord.CHChart],
- 0x1003: ["CHSERIES", "?"],
+ 0x1003: ["CHSERIES", "Chart Series", xlsrecord.CHSeries],
0x1006: ["CHDATAFORMAT", "?"],
0x1007: ["CHLINEFORMAT", "Line or Border Formatting of A Chart"],
0x1009: ["CHMARKERFORMAT", "?"],
@@ -252,6 +252,7 @@
0x105F: ["CH3DDATAFORMAT", "?"],
0x1061: ["CHPIEEXT", "?"],
0x1062: ["CHLABELRANGE2", "?"],
+ 0x1065: ["CHSIINDEX*", "?"],
0x1066: ["CHESCHERFORMAT", "?"]
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]