Skip to content

Conversation

@apteryks
Copy link
Contributor

@apteryks apteryks commented Aug 4, 2014

Example of use:

from docx import Document

doc = Document()
table = doc.add_table(6,6)
header_row = table.rows[0]
header_row.merge_cells()

# args can also be passed to merge_cells(mergeStart, mergeStop) in order to implement any kind of merge
# on the same row, such as:
table.rows[1].merge_cells(0,3)  # This will merge the cells indexed from 0 to 2.

@apteryks apteryks mentioned this pull request Aug 4, 2014
@apteryks apteryks changed the title Merge cells feature Add support for merging the cells of a single table row. Aug 4, 2014
@scanny
Copy link
Contributor

scanny commented Aug 5, 2014

Thanks @apteryks, we'll keep this around. I can't merge it as is but it may be a handy reference when we get to the implementation. If we use any of it I'll credit you on those commits.

Just so you know, to be committable it would require acceptance and unit tests, and we would have to agree ahead of time on the API. Always happy to discuss this sort of thing, so feel free to reach out on this list or on the mailing list python-docx-dev@googlegroups.com to talk about any work you're planning that you'd like to contribute.

API-wise on this one I'm thinking Cell.merge(other_corner_cell) is what we'd want to go with. That way the same call can be used for column or row merging or both.

Anyway, spikes like this are often handy and I always check them out before working on a feature to see what I can learn before diving in, so thanks again for taking the time to submit it :)

@apteryks
Copy link
Contributor Author

apteryks commented Aug 5, 2014

Hello Steve! I couldn't find a python-docx-dev group, so I continued this discussion here.

@apteryks apteryks closed this Aug 20, 2014
@apteryks apteryks deleted the merge_cells_feature branch August 20, 2014 17:48
@apteryks
Copy link
Contributor Author

Hello Steve, this issue can be closed, thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants