- 그럴 필요 그것을 찾으려면 소스 코드를 읽으십시오. 이 작업을 수행하는 Worksheet
클래스에는 두 가지 방법, write_merge
및 merge
이 있습니다. merge
은 기존 셀을 가져 와서 병합하는 반면 write_merge
은 레이블을 작성하고 (write
처럼) 동일한 항목 인 merge
을 작성합니다.
두 셀 모두 병합 할 셀을 r1, r2, c1, c2
으로 가져오고 선택적인 style
매개 변수를 허용합니다.
sheet.write_merge(0, 0, 0, 1, 'Long Cell')
sheet.write(1, 0, 1)
sheet.write(1, 1, 2)
가 호출이 작동하는 방법에 대한 자세한 명시하기 : 또는
top_row = 0
bottom_row = 0
left_column = 0
right_column = 1
sheet.write_merge(top_row, bottom_row, left_column, right_column, 'Long Cell')
, merge
사용 :
sheet.write(top_row, left_column, 'Long Cell')
sheet.merge(top_row, bottom_row, left_column, right_column)
귀하의 예제에서
,이 간단한 호출 될 것이다
merge
소스를 가리키는 몇 가지 의견이 있습니다. ntial 문제 :
# Problems: (1) style to be used should be existing style of
# the top-left cell, not an arg.
# (2) should ensure that any previous data value in
# non-top-left cells is nobbled.
# Note: if a cell is set by a data record then later
# is referenced by a [MUL]BLANK record, Excel will blank
# out the cell on the screen, but OOo & Gnu will not
# blank it out. Need to do something better than writing
# multiple records. In the meantime, avoid this method and use
# write_merge() instead.
그러나이 같은 간단한 경우에 잘 될 것입니다.
@ShivanRaptor 내 질문을 업데이트했습니다. 감사. –