Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#8 Error reading multi line cells from OOo 2.4

open
nobody
General (7)
5
2009-01-22
2009-01-22
Sergio Vernis
No

When ooolib read an OOo 2.4 spreadsheet with multi line cells, ir read only the first element, and trunck the rest.

The solution is attached.

Discussion

  • Sergio Vernis
    Sergio Vernis
    2009-01-22

    Version patched

     
    Attachments
  • Claude Paroz
    Claude Paroz
    2010-06-12

    Same problem here. My patch is slightly different, but with the same effect:

    --- ooolib/__init__.py 2010-06-11 17:21:42.838569804 +0200
    +++ ooolib.py 2010-06-12 11:00:46.000000000 +0200
    @@ -1098,6 +1098,10 @@
    if (self.parser_cell_string_pending == True):
    self.parser_cell_string_line = "%s\n" % (self.parser_cell_string_line)

    + if (self.parser_element == 'text:p'):
    + if len(self.parser_cell_string_line):
    + self.parser_cell_string_line = "%s\n" % (self.parser_cell_string_line)
    +
    # Debugging statements
    if self.debug: print " List: ", self.parser_element_list
    if self.debug: print " Attributes: ", attrs
    @@ -1109,13 +1113,11 @@
    print "Tag Mismatch: '%s' != '%s'" % (name, self.parser_element)
    self.parser_element_list.pop()

    - # If the element was text:p and we are in string mode
    - if (self.parser_element == 'text:p'):
    - if (self.parser_cell_string_pending):
    - self.parser_cell_string_pending = False
    -
    # Take care of repeated cells
    if (self.parser_element == 'table:table-cell'):
    + # Close pending string
    + if (self.parser_cell_string_pending):
    + self.parser_cell_string_pending = False
    self.parser_sheet_column += self.parser_cell_repeats

    # Readjust parser_element_list and parser_element