tbeckham / prettytable

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

Pagination for lp #32

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. pipe = subprocess.os.popen('lp','w')
2. pipe.write(table.get_string())
3. pipe.close()

What is the expected output? What do you see instead?
Headers appear on first page only. It would be nice to be able to paginate for 
some number of lines per pate

What version of the product are you using? On what operating system?
0.7.2

Please provide any additional information below.
Example of code attached. There may be a need to specify columns per page as 
well.

Original issue reported on code.google.com by brenvo...@gmail.com on 21 Jul 2013 at 11:06

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
change required to print table with fewer lines than pagelen:

30c30,33
<     cline = eline < pagelen and 0 or cline + pagelen
---
>     if eline < pagelen:
>         cline = 0 
>     else:
>         cline += pagelen

Original comment by brenvo...@gmail.com on 22 Jul 2013 at 2:56

Attachments:

GoogleCodeExporter commented 8 years ago
Hello.  Thanks for this request, and my apologies for the extremely slow 
response time.

I have just implemented a "paginate" method in the SVN trunk which produces a 
string suitable for passing to lp (but it's up to the user to pass it to lp, I 
didn't want to put that into PrettyTable).  It looks like this:

table.paginate(page_length=58, **kwargs),

where the kwargs can be anything that you would normally pass to get_string 
(including start and end, which enable only paginating a subset of the table).

Please give the new code a test in your application and let me know if it works 
as required or not.  Sorry again for the delay.

Original comment by luke@maurits.id.au on 7 Oct 2013 at 10:17