행 높이 ( Row height )
# 첫번째 행 높이
worksheet.set_row(0, 38)
# 첫번째 행 높이 픽셀단위
worksheet.set_row_pixels(0, 38)
# 아홉번째 행 높이
worksheet.set_row(8, 10)
# 세번째 행 높이 픽셀단위
worksheet.set_row_pixels(2, 38)
셀 넓이 ( Cell width )
# A부터 B까지 20 넓이
worksheet.set_column(0, 1, 20)
# C부터 C까지 64 픽셀 넓이
worksheet.set_column_pixels(2, 2, 64)
# D부터 D까지 30 넓이
worksheet.set_column(4, 4, 30)
셀 병합 ( Cell Merge )
merge_format = workbook.add_format({
'bold': 1,
'align': 'center',
})
worksheet.merge_range('A4:D4', '병합', merge_format)
숫자 포맷 (Number Format)
num_format = workbook.add_format({'num_format': '#,##0'})
worksheet.write('B4', 1000, num_format)
참조
[xlsxwriter 공식문서]: https://xlsxwriter.readthedocs.io/
Creating Excel files with Python and XlsxWriter — XlsxWriter Documentation
xlsxwriter.readthedocs.io
728x90
'Programing Language > Python' 카테고리의 다른 글
[Python] 문자열 존재여부 (0) | 2023.03.08 |
---|---|
[Python] default value if none (0) | 2023.03.06 |
[Python] AttributeError: module 'datetime' has no attribute 'now' (0) | 2023.02.21 |
[Python] 딕셔너리 키 존재여부 확인하기 (0) | 2023.02.21 |
[Python] 타입 비교 (0) | 2023.02.21 |
댓글