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

More control over table borders #957

Open
tfenne opened this issue Oct 13, 2023 · 3 comments · May be fixed by #1005
Open

More control over table borders #957

tfenne opened this issue Oct 13, 2023 · 3 comments · May be fixed by #1005

Comments

@tfenne
Copy link

tfenne commented Oct 13, 2023

Please explain your intent
The Table feature is fantastic, but I find that I want more control over borders that is provided by TableBorderLayout. I would really like to be able to control exactly which borders are turned on, and ideally also their thickness, independently.

Describe the solution you'd like
I was thinking that perhaps:

  1. TableBorderLayout could become a regular class instead of an enum, so that a user could create instances of it
  2. The existing values (e.g. HORIZONTAL_LINES) could still be class variables so that existing usage doesn't break
  3. The class would hold on to a function/lamba that is called for every border segment for a table, and would return perhaps a thickness (0=off?) and a color (so table borders don't have to be black).

For (3) I'm imagining the function looking something like:

def should_render(rownum: int, colnum: int, is_header: bool, is_footer:bool, side: ?) -> ...?

Additional context
I'm actually trying to port some nasty Rmarkdown -> latex -> PDF code, and users have gotten used to some latex table styling, which I can't reproduce. One example is a table with i) thick borders above/below the table, ii) thin borders under the headerline, iii) no other borders.

@gmischler
Copy link
Collaborator

Another interesting suggestion, @tfenne!

The current border handling for tables is indeed not particularly flexible, since the available combinations of border lines are essentially hardcoded. As another consequence, they will all have the same color (I haven't checked, but I think FPDF.draw_color should take effect here).

Your idea introduces a lot more complexity, but might actually work. As always, the proof is in the PR... 😉

@Lucas-C
Copy link
Member

Lucas-C commented Oct 30, 2023

Hi @tfenne 😊

Would like to move forward with this suggestion and work on a PR?

@tfenne
Copy link
Author

tfenne commented Oct 30, 2023

@Lucas-C: someone else (@TedBrookings) on my team is actually actively working on this and will submit a PR hopefully this week.

@TedBrookings TedBrookings linked a pull request Nov 6, 2023 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants