使用 xlsxwriter 自动扩展行
Auto-Expand Rows with xlsxwriter
当我点击 excel 中两行之间的线时,我可以自动将列扩展到其中任何行的最大长度:
当我使用 xlsxwriter 创建 Excel 时,我是否有机会预渲染 excel 以使所有行自动扩展到此最大宽度?
我知道 set_column 但它不符合我的要求,因为你需要给它一个绝对宽度。
这是不可能的,因为它不是文件格式的一部分。来自 XlsxWriter FAQ:
Q. Is there an “AutoFit” option for columns?
Unfortunately, there is no way to specify “AutoFit” for a column in the Excel file format. This feature is only available at runtime from within Excel. It is possible to simulate “AutoFit” by tracking the width of the data in the column as your write it.
当我点击 excel 中两行之间的线时,我可以自动将列扩展到其中任何行的最大长度:
当我使用 xlsxwriter 创建 Excel 时,我是否有机会预渲染 excel 以使所有行自动扩展到此最大宽度?
我知道 set_column 但它不符合我的要求,因为你需要给它一个绝对宽度。
这是不可能的,因为它不是文件格式的一部分。来自 XlsxWriter FAQ:
Q. Is there an “AutoFit” option for columns?
Unfortunately, there is no way to specify “AutoFit” for a column in the Excel file format. This feature is only available at runtime from within Excel. It is possible to simulate “AutoFit” by tracking the width of the data in the column as your write it.