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

How do I acheive this table formatting? #103

Open
JapanIsShinto opened this issue May 16, 2023 · 1 comment
Open

How do I acheive this table formatting? #103

JapanIsShinto opened this issue May 16, 2023 · 1 comment

Comments

@JapanIsShinto
Copy link

I am having a hard time understanding the various table formatting options. I have code that makes a table that looks like this. The only formatting I have added is to center text in each column and to set the cell width equally to all interior cells:

+---+----------------+----------------+----------------+----------------+----------------+----------------+
|   |        A       |        B       |        C       |        D       |        E       |        F       |
+---+----------------+----------------+----------------+----------------+----------------+----------------+
| 1 |   588 490 472  |  1023 913 861  |   689 739 911  |   580 620 539  |   758 708 875  |   704 870 880  |
+---+----------------+----------------+----------------+----------------+----------------+----------------+
| 2 |  1022 784 571  |   575 577 880  |  1023 692 690  |   573 438 596  |   901 982 740  |   979 836 601  |
+---+----------------+----------------+----------------+----------------+----------------+----------------+
| 3 |   378 381 666  |   598 766 645  |   923 534 503  |  1022 1010 748 |   967 652 809  |   464 643 814  |
+---+----------------+----------------+----------------+----------------+----------------+----------------+
| 4 | 1023 1015 1023 | 1023 1012 1023 |   965 961 991  |   712 708 735  |   489 483 518  |   293 279 320  |
+---+----------------+----------------+----------------+----------------+----------------+----------------+

What I want is this formatting:

            A                B                C                D                E                F       
   +----------------+----------------+----------------+----------------+----------------+----------------
 1 |   588 490 473     1023 913 862      689 739 911      581 621 539      759 709 876      705 870 881   
 2 |  1022 784 572      575 577 881     1023 692 690      573 439 596      901 982 740      980 837 601   
 3 |   379 382 667      599 767 645      923 535 504     1023 1010 749     967 653 810      464 643 814   
 4 | 1023 1015 1023   1023 1013 1023     966 962 992      713 708 736      489 483 519      294 280 320  

What do I need to achieve this? I've played with various combinations of hiding borders, changing border and corner characters, and other things, but the result is usually parts look like what I want, and other parts are wrong. I think I'm just missing some core concepts in the rendering model, or possibly how I'm specifying the directives with the fluent interface.

How should I approach formatting the table like above?

@jameshanlon
Copy link

jameshanlon commented Dec 4, 2023

+1 This would be very useful and the first thing I wanted the library to do.

See 'Table format' in Python's tabulate for examples of what would be great to provide with this library.

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