Worksheet.set_column() sets the column width only once
See original GitHub issueInside the method:
out = StringIO.StringIO()
workbook = xlsxwriter.workbook.Workbook(out)
worksheet = workbook.add_worksheet()
worksheet.set_column('A:A', 1)
worksheet.set_column('A:A', 100)
workbook.close()
out.seek(0)
return out
Expected outcome:
Actual outcome:
I don’t think it’s a LibreOffice issue this time, because the width is, in fact, set - but only once.
Issue Analytics
- State:
- Created 10 years ago
- Comments:15 (6 by maintainers)
Top Results From Across the Web
The Worksheet Class — XlsxWriter Documentation
The write_row() method can be used to write a list of data in one go. This is useful for ... worksheet.set_column(1, 1, 30)...
Read more >Simulate autofit column in xslxwriter - python - Stack Overflow
As a general rule, you want the width of the columns a bit larger than the size of the longest string in the...
Read more >How to change and AutoFit column width in Excel - Ablebits
Another way to autofit columns in Excel is by using the ribbon: select one or more columns, go to the Home tab >...
Read more >Change the column width and row height - Microsoft Support
Individual rows and columns can only have one setting. For example, a single column ... Change the default width for all columns on...
Read more >How to: Specify Row Height or Column Width - C# & VB.NET
Set Column Width. This example demonstrates how to control the column width in a worksheet. #Set the Width for Individual Columns. To specify ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The last range will show up in Excel. The first in LibreOffice.
Instead you should do something like the following, which will work without a bug fix in LibreOffice/Excel:
No.
It might work in Excel but probably not in LibreOffice.
When you split a column range in Excel you get n+1 ranges. For example this:
In Excel would be:
If you have a small number of columns (<1000) then I would recommend just setting each one individually. Like this:
Note, this won’t work in LibreOffice until after the bug fix for this issue but it currently works with Excel.