diff --git a/camelot/core.py b/camelot/core.py index a093774e..600634ca 100644 --- a/camelot/core.py +++ b/camelot/core.py @@ -647,20 +647,21 @@ def copy_spanning_text(self, copy_text=None): Returns ------- - t : camelot.core.Table + table : camelot.core.Table + """ for f in copy_text: if f == "h": for i in range(len(self.cells)): for j in range(len(self.cells[i])): if self.cells[i][j].text.strip() == "": - if self.cells[i][j].hspan and not self.cells[i][j].left: + if not self.cells[i][j].left: self.cells[i][j].text = self.cells[i][j - 1].text elif f == "v": for i in range(len(self.cells)): for j in range(len(self.cells[i])): if self.cells[i][j].text.strip() == "": - if self.cells[i][j].vspan and not self.cells[i][j].top: + if not self.cells[i][j].top: self.cells[i][j].text = self.cells[i - 1][j].text return self diff --git a/camelot/parsers/lattice.py b/camelot/parsers/lattice.py index 693b5a08..1aee658b 100644 --- a/camelot/parsers/lattice.py +++ b/camelot/parsers/lattice.py @@ -169,16 +169,16 @@ def _reduce_index(table, idx, shift_text): indices = [] for r_idx, c_idx, text in idx: for d in shift_text: - if d == "l" and table.cells[r_idx][c_idx].hspan: + if d == "l": while not table.cells[r_idx][c_idx].left: c_idx -= 1 - if d == "r" and table.cells[r_idx][c_idx].hspan: + elif d == "r": while not table.cells[r_idx][c_idx].right: c_idx += 1 - if d == "t" and table.cells[r_idx][c_idx].vspan: + elif d == "t": while not table.cells[r_idx][c_idx].top: r_idx -= 1 - if d == "b" and table.cells[r_idx][c_idx].vspan: + elif d == "b": while not table.cells[r_idx][c_idx].bottom: r_idx += 1 indices.append((r_idx, c_idx, text))