Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Think of cleverer way of doing split headers #12

Open
frabcus opened this issue Jan 27, 2015 · 1 comment
Open

Think of cleverer way of doing split headers #12

frabcus opened this issue Jan 27, 2015 · 1 comment

Comments

@frabcus
Copy link
Contributor

frabcus commented Jan 27, 2015

e.g. In ashe, where it has one header cell split into three cells in Excel.

This is current code in recipe, which is horrid:
6db4f5c

@goatchurchprime
Copy link
Contributor

This could be done by running this function to repeat the contents of multiple width cells into each cell

def FixMultipleCellsHeading(tab):
    hh = tab.excel_ref("C6:P9").is_not_whitespace()
    for cc in hh:
        val = cc.value
        ch = set(cc.children().unordered_cells)
        xwidth = len(set(c.x  for c in ch))
        ywidth = len(set(c.y  for c in ch))
        if ywidth == 1:
            for c in ch:
                c.value = val
        elif xwidth == 1:
            bottomcell = max(ch, key=lambda X:X.y)
            for c in ch:
                c.value = ''
            bottomcell.value = val

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

No branches or pull requests

2 participants