简体   繁体   中英

xlsx writer set_row sometimes won't work

I m using xlsx writer to export some files on excel when i try to fix the height of the row with set_row, in case worked in another won't work.

worksheet.set_row(5, 30) worksheet.set_row(6, 30) worksheet.set_row(7, 30)

as a result i got this :

` 在此处输入图片说明

we can see that the set_row was applied on the row 7 and 8 and won't apply on the row 6

Can anyone help me with this please, Thanks.

The following working example based on your code shows that it works:

import xlsxwriter

workbook = xlsxwriter.Workbook('file.xlsx')
worksheet = workbook.add_worksheet()

worksheet.set_row(5, 30)
worksheet.set_row(6, 30)
worksheet.set_row(7, 30)

for row_num in range(4, 9):
    worksheet.write(row_num, 0, "Text")

workbook.close()

Output:

在此处输入图片说明

Perhaps you can add a Minimal, Complete, and Verifiable example that demonstrates it not working.

我发现了问题,那么在写入单元格之前,您需要使用set_row。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM