src/xlsrecord.py | 30 +++++++++++++++++++++++++++++- src/xlsstream.py | 3 ++- 2 files changed, 31 insertions(+), 2 deletions(-)
New commits: commit ae360336389ce7cf15cc7501cf50454ae5929e2c Author: Kohei Yoshida <kohei.yosh...@suse.com> Date: Fri Jan 20 23:19:32 2012 -0500 Parse shared formula records. diff --git a/src/xlsrecord.py b/src/xlsrecord.py index 11c2fce..9e31317 100644 --- a/src/xlsrecord.py +++ b/src/xlsrecord.py @@ -1,6 +1,6 @@ ######################################################################## # -# Copyright (c) 2010 Kohei Yoshida +# Copyright (c) 2010-2012 Kohei Yoshida # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation @@ -2631,6 +2631,34 @@ class FeatureHeader(BaseRecordHandler): return +class ShrFmla(BaseRecordHandler): + + def __parseBytes (self): + self.ref = RefU(self) + self.readBytes(1) # 8-bits reserved + self.cUse = self.readUnsignedInt(1) + lenFormula = self.readUnsignedInt(2) + self.tokens = self.readBytes(lenFormula) + + def parseBytes (self): + self.__parseBytes() + self.appendLine("range: %s"%self.ref.toString()) + self.appendLine("cell count: %d"%self.cUse) + self.appendLine("formula token length: %d"%len(self.tokens)) + if len(self.tokens): + ftext = None + try: + parser = formula.FormulaParser(self.header, self.tokens) + parser.parse() + ftext = parser.getText() + except formula.FormulaParserError as e: + ftext = "(Error: %s)"%e.args[0] + if ftext != None: + self.appendLine("formula: %s"%ftext) + + + + # ------------------------------------------------------------------- # SX - Pivot Table diff --git a/src/xlsstream.py b/src/xlsstream.py index bb9f6ae..57b5e13 100644 --- a/src/xlsstream.py +++ b/src/xlsstream.py @@ -1,6 +1,6 @@ ######################################################################## # -# Copyright (c) 2010 Kohei Yoshida +# Copyright (c) 2010-2012 Kohei Yoshida # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation @@ -220,6 +220,7 @@ recData = { 0x027E: ["RK", "Cell with Encoded Integer or Floating-Point", xlsrecord.RK], 0x0293: ["STYLE", "Style Information", xlsrecord.Style], 0x041E: ["FORMAT", "Number Format", xlsrecord.Format], + 0x04BC: ["SHRFMLA", "Shared Formula", xlsrecord.ShrFmla], 0x0802: ["QSISXTAG", "Pivot Table and Query Table Extensions", xlsrecord.PivotQueryTableEx], 0x0809: ["BOF", "Beginning of File", xlsrecord.BOF], 0x0810: ["SXVIEWEX9", "Pivot Table Extensions", xlsrecord.SXViewEx9], _______________________________________________ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits