tienbm90 / prettytable

Automatically exported from code.google.com/p/prettytable
Other
0 stars 0 forks source link

Optional table title #30

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
An enhancement request for an option that will cause a title to be displayed.

+--------------------------+
|        Neat Example      |
+------------+-------------+
|   Column   | And another |
+------------+-------------+

Original issue reported on code.google.com by chao...@minorcrash.com on 10 May 2013 at 8:13

GoogleCodeExporter commented 8 years ago
I need this feature desperately. I have been reading through the code base and 
think I can implement it myself if I'm pointed in the right direction regarding 
get_string. There are plenty of examples of adding options.

Original comment by chao...@minorcrash.com on 10 May 2013 at 8:15

GoogleCodeExporter commented 8 years ago
This is a good suggestion!  Many thanks.

I'll put this in the next release but if you want to hack it in yourself for 
now, I would integrate it into the block of code starting at line 992 (in 
trunk), with the commend "Add header or top of border" above it.

Original comment by luke@maurits.id.au on 10 May 2013 at 8:32

GoogleCodeExporter commented 8 years ago
I just started work on it. I'll submit a patch when I am done. get_html_string 
will also need to be updated, it looks like.

Original comment by chao...@minorcrash.com on 12 May 2013 at 11:46

GoogleCodeExporter commented 8 years ago
It is proving more difficult than I first anticipated. What's the proper way to 
get the top rule shown in my diagram without introducing the column dividers? 
And should we wrap the title or expand the size of the table? I would desire 
the latter, but the former appears easier within the current code base.

Original comment by chao...@minorcrash.com on 15 May 2013 at 3:18

GoogleCodeExporter commented 8 years ago
This is now implemented in trunk.  Just do table.title = "My table" to set the 
title.  If the title is too long, the table size is expanded to accommodate.  
Please feel free to test and give feedback.

Original comment by luke@maurits.id.au on 7 Oct 2013 at 8:48