我将其重写以简化当前问题:
我需要使用pandas和xlsxwriter在MS Windows Excel 2007+中根据每行特定列中的文本长度动态扩大行大小。我正在与经验更丰富的开发人员一起工作,但是如果没有出现小错误,我们似乎无法实现这一目标,某些行似乎是随机行,底部有多余的空白:
我在下面包括了格式代码和输出不令人满意的图像:
#this is the formatting which is being applied on the column with the wrapped text:
description_format = workbook.add_format({'font_name': 'Arial', 'font_size': 9, 'bold': False, 'text_wrap': True, 'bottom': 1, 'top': 2, 'left': 0, 'right': 0})
#this is the formatting being applied to all cells:
format5 = workbook.add_format({'font_name': 'Arial', 'font_size': 9, 'bold': False, 'text_wrap': True, 'valign': 'top'})
Here is the image of the output, with the extra white space at the bottom of the rows.