jmcnamara / XlsxWriter

A Python module for creating Excel XLSX files.
https://xlsxwriter.readthedocs.io
BSD 2-Clause "Simplified" License
3.66k stars 631 forks source link

Bug: set_row not working after set_default_row #1087

Open 80avin opened 2 months ago

80avin commented 2 months ago

Current behavior

The row with index (zero-based) = 0 gets set to 50 unit high.

This works if I set_row with 14,16 heights.

Expected behavior

The row with index (zero-based) = 0 should be set to 15 units high.

Sample code to reproduce

import xlsxwriter

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

worksheet.write('A1', 'Hello world')
worksheet.set_default_row(50)
worksheet.set_row(0, 15)
# workaround:
# worksheet.set_row(0, 16)

workbook.close()

Environment

- XlsxWriter version: 3.2.0
- Python version: 3.12
- Excel version: NA
- OS: Ubuntu 24.04

Any other information

Since 15 is the default height, I think it avoids updating the sheet if I set a row height to 15. It should verify whether set_row is called with current default, only then it may avoid.

OpenOffice and LibreOffice users

jmcnamara commented 2 months ago

The row with index (zero-based) = 0 should be set to 15 units high.

This happens, as you guessed, because the 15 is the normal default height for a row. You can work around it by setting the row height to 15.001 or similar.

Either way it is a bug. I'll look into it.