merge_range works only one time in constant memory mode
See original GitHub issueHi everyone,
im using Python 3.4.3 , xlsxwriter 0.7.3
here a short code example:
workbook = xlsxwriter.Workbook("text.xlsx", {'constant_memory': True})
worksheet = workbook.add_worksheet()
header = workbook.add_format({'bold': True, 'border': 1,
'border_color': "#000000",
'bg_color': '#808080',
'valign': "vcenter",
'align': "center",
'font_color': '#FFFFFF'})
header.set_text_wrap()
worksheet.merge_range(5,0,6,0, 'Ebene', header)
worksheet.merge_range(5,1,6,1, 'Monat', header)
worksheet.merge_range(5,2,6,2, 'Marke', header)
worksheet.merge_range(5,3,6,3, 'abcde', header)
workbook.close()
and the result shown in Excel 2013
no matter how i reorder it, always the first call of merge_range works properly, the following ones are broken like above.
Remove the {'constant_memory': True}
and everything works fine.
regards
Issue Analytics
- State:
- Created 8 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Working with Memory and Performance - XlsxWriter
XlsxWriter in constant_memory mode: the execution time still increases linearly with the number of rows but the memory usage remains small and constant: ......
Read more >Python Xlsxwriter not overwriting when in constant mode on
From the XslxWriter docs: constant_memory: Reduces the amount of data stored in memory so that large files can be written efficiently:
Read more >Working with Memory and Performance - libxlsxwriter
Constant Memory Mode. By default libxlsxwriter holds all cell data in memory to allow non-sequential data storage. The effect of this is that...
Read more >VBA Merge Cells & Unmerge Cells
You can merge columns using VBA and the column letters. The following code will merge columns A:C. Sub MergeColumns() Range("A:C").Merge End Sub.
Read more >ALTER PARTITION FUNCTION (Transact-SQL) - SQL Server
The statement can also merge two partitions into one partition. Caution. More than one table or index can use the same partition function....
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
Hi,
I’ve added documentation to highlight that merged ranges don’t work when
constant_memory
mode is enabled.It is possible to workaround this limitation by writing the merge range cells in row-column order and later calling
merge_range()
. This requires filling in any non data cells in the range with blank cells. Here is an example based on yours:To fix this properly would require a reasonable amount of work that probably isn’t worth it for the small number of people that this would affect.
So I’m closing this as a documented limitation.
Regards,
John
@jmcnamara thanks for you time. so the problem is you need to feed the writer iterated, from my view, its like the common issue among SQL ORM libraries. many has a autocommit option which let the user’s operation be send to database, but you still could hold some for your purpose and commit explicit
or you could treat writer job like a transaction in those SQL operations. mostly its single statement, while sometime it could accept multi statement. in this case, mostly you could send single row, but sometimes you could send multi rows with merge operation done