- आप करने के लिए है इसे खोजने के लिए स्रोत कोड पढ़ें। ऐसा करने के लिए 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 मैंने अपना प्रश्न अपडेट किया है। धन्यवाद। –