def _calc_spans(self, rows, nrcols):
# calculate colspan
for row in rows:
target = None
for c in range(nrcols):
if row[c] is not None:
# try to extend colspan on this cell
target = row[c]
else:
if target is not None:
# extend colspan
target[1] += 1
# convert arrays to tuples
# arrays are needed to patch up colspan and rowspan
# the table builder requires each cell to be a tuple, not an array
for row in rows:
for c in range(nrcols):
if row[c] is not None:
row[c] = tuple(row[c])
评论列表
文章目录