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

Borders are not appeared on merged cells #74

Open
AAO2014 opened this issue Aug 13, 2018 · 3 comments
Open

Borders are not appeared on merged cells #74

AAO2014 opened this issue Aug 13, 2018 · 3 comments
Assignees

Comments

@AAO2014
Copy link

AAO2014 commented Aug 13, 2018

To make the borders to be visible I have to draw the borders before these cells will be merged. Otherwise, the borders will be drawn partly, only on some merged cells.
image

In other words: if I merge some cells, and after that I draw borders around of the range of the cells, not all borders are visible. But if I draw all borders on all the cells and then merge them -- all the borders are visible.
image

But, in any cases, thanks for great job! I like your package!

@kevmo314
Copy link
Collaborator

Thanks for the report, this one might be tricky to fix. Seems like the spec is a bit vague here, but we'll take a look.

@hamx0r
Copy link

hamx0r commented Aug 24, 2018

I'm seeing a related border issue so I'm adding a note here instead of opening a new ticket:

I have 4 cells merged as a header and I'm adding Left borders to the left-most column of the 4, and a Right border to the right-most. The middle two columns are untouched style-wise. However, I'm getting Right and Left columns applied to the "outside" two columns like this:
extra_borders

The code producing this is:
# Set vertical borders bounding cols D through G for 29 rows
start = "D1
end = "G1"
ws.range(start, end).merge()

                        # Set vertical borders
                        start = "D1"
                        end = "D29"
                        ws.range(start, end).style.borders.left.style = '_'

                        start = "G1"
                        end = "G29"
                        ws.range(start, end).style.borders.right.style = '_'

                        # Now set vertical borders bounding cols H through K 
                        start = "H1
                        end = "K1"
                        ws.range(start, end).merge()

                        # Set vertical borders
                        start = "H1"
                        end = "H29"
                        ws.range(start, end).style.borders.left.style = '_'

                        start = "K1"
                        end = "K29"
                        ws.range(start, end).style.borders.right.style = '_'

If I instead draw borders starting from row 2 (ie change start to D2, G2, H2 and K2 respectively above) then I no longer get the Right border on cols D & H, but still get Left borders on cols G & K. This tells me that the merged cells in row 1 are having an impact. If I remove the code merging those cells, or place it after the code drawing borders, then I get the results in this paragraph (ie only get the extra Left border in cols G&K).

To me, it's a fine solution to obey the rule "Draw borders before merging". I'd still like the borders to be drawn for the ranges defined and not have extra borders added in on G and K. My work-around is to instead never right Right borders, but instead draw Left borders on the next column to the right (H & L). This gives the expected output below

The expected borders are here (notice no right borders on cols D & H, nor left borders on cols G & K)
expected_borders

@kevmo314
Copy link
Collaborator

Yeah the spec is kind of vague about how to accurately specify this kind of situation. I'll take a look but it'll require a bit of experimentation to see what kind of configurations Excel spits out, so this may be a bit challenging to solve effectively.

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

3 participants