From cd30c047d9d0e5ad6f277e7c98851b0afb183864 Mon Sep 17 00:00:00 2001
From: Kevin Deldycke <kevin@nexedi.com>
Date: Fri, 29 Apr 2005 15:59:39 +0000
Subject: [PATCH] Delete empty lines earlier

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2975 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5OOo/OOoUtils.py | 30 +++++++++++-------------------
 1 file changed, 11 insertions(+), 19 deletions(-)

diff --git a/product/ERP5OOo/OOoUtils.py b/product/ERP5OOo/OOoUtils.py
index 990539bbc0..9c010cca60 100755
--- a/product/ERP5OOo/OOoUtils.py
+++ b/product/ERP5OOo/OOoUtils.py
@@ -257,7 +257,17 @@ class OOoParser:
             table_line.append(cell_text)
             col_number += 1
 
-        table.append(table_line)
+        # Delete empty lines if needed
+        if no_empty_lines:
+          empty_cell = 0
+          for table_cell in table_line:
+            if table_cell == None:
+              empty_cell += 1
+          if empty_cell == len(table_line):
+            table_line = None
+
+        if table_line != None:
+          table.append(table_line)
         line_number += 1
 
     # Reduce the table to the minimum
@@ -266,8 +276,6 @@ class OOoParser:
                                 , width  = text_min_bounds['width']
                                 , height = text_min_bounds['height']
                                 )
-    if no_empty_lines:
-      table = self._deleteTableEmptyLines(table)
     return {table_name: table}
 
 
@@ -323,22 +331,6 @@ class OOoParser:
     return table
 
 
-  security.declarePrivate('_deleteTableEmptyLines')
-  def _deleteTableEmptyLines(self, table):
-    """
-      Delete table empty lines.
-    """
-    new_table = []
-    for line in table:
-      empty_cell = 0
-      for cell in line:
-        if cell == None:
-          empty_cell += 1
-      if empty_cell != len(line):
-        new_table.append(line)
-    return new_table
-
-
   security.declarePrivate('_getTableListUnion')
   def _getTableListUnion(self, list1, list2):
     """
-- 
2.30.9