问题
I want to merge several series of cell ranges in an Excel file using Python Xlsxwriter, I found the Python command in the Xlsxwriter documentation in this website http://xlsxwriter.readthedocs.org/en/latest/example_merge1.html as below:
worksheet.merge_range('B4:D4')
The only problem is that I have my ranges in row and columns numbers format for example (0,0) which is equal to A1. But Xlsxwriter seems to only accept format like A1. I was wondering if anybody else had the same problem and if there is any solution for that.
回答1:
Almost all methods in XlsxWriter support both A1
and (row, col)
notation, see the docs. So the following are equivalent for merge_range():
worksheet.merge_range('B4:D4', 'Merged Range', merge_format)
worksheet.merge_range(3, 1, 3, 3, 'Merged Range', merge_format)
来源:https://stackoverflow.com/questions/26837888/merging-excel-cells-using-xlsxwriter-in-python