diff --git a/product/ERP5OOo/OOoUtils.py b/product/ERP5OOo/OOoUtils.py index c06a97c88be3a48a2b95324b82bfecff81d23769..eb2d9a4f66cdb446940aabf3438d772ea386a2be 100644 --- a/product/ERP5OOo/OOoUtils.py +++ b/product/ERP5OOo/OOoUtils.py @@ -464,7 +464,7 @@ class OOoParser(Implicit): return ''.join(part for part in [node.text, node.tail] if part) # we can also have table:annotation, and they are ignored - cell_data = format_node(cell) + cell_data = format_node(cell) or None # Add the cell to the line table_line.append(cell_data) diff --git a/product/ERP5OOo/tests/testOOoParser.py b/product/ERP5OOo/tests/testOOoParser.py index 70546f94e2d2a09432820e8cf01a4a6051a0ce40..80f870ebf7d1daa0ae65cfb3a02841eca142202b 100644 --- a/product/ERP5OOo/tests/testOOoParser.py +++ b/product/ERP5OOo/tests/testOOoParser.py @@ -116,6 +116,18 @@ class TestOOoParser(unittest.TestCase): self.assertEquals(mapping['Feuille1'][2], ['tab\t']) self.assertEquals(mapping['Feuille1'][3], ['New\nLine']) + def test_getSpreadSheetMappingEmptyCells(self): + parser = OOoParser() + parser.openFile(open(makeFilePath('empty_cells.ods'), 'rb')) + mapping = parser.getSpreadsheetsMapping() + self.assertEquals(['Feuille1'], mapping.keys()) + self.assertEquals(mapping['Feuille1'], + [ + ['A1', None, 'C1'], + [], + [None, 'B3',], + ]) + def test_suite(): suite = unittest.TestSuite() diff --git a/product/ERP5OOo/tests/test_document/empty_cells.ods b/product/ERP5OOo/tests/test_document/empty_cells.ods new file mode 100644 index 0000000000000000000000000000000000000000..68e0eade818161501bed195d770c6f601aa54abc Binary files /dev/null and b/product/ERP5OOo/tests/test_document/empty_cells.ods differ