Results 1 to 3 of 3

Thread: What is best way to print multiple pages long table?

  1. #1
    Join Date
    Feb 2012
    Posts
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question What is best way to print multiple pages long table?

    Hi,

    I need to create a raport that is basically long table of items, spanning across multiple pages. So far I created simple html document using QTextEdit/QTextDocument ability to store some rich text elements like tables, and then simply use print method of QTextEdit\QPrinter to print it.

    The problem is, however, printing tables like this kind of fails on page breaks - row is often split on separate pages (sometimes with additional glitches) and this is not what I want.
    My question is - is there a way to ensure that table rows are always printed entirely on single page, i.e if there is not enugh space left on the current page, then draw new row on the next page, instead of slicing it in half?

    If not, do you guys have better, tried ways to print this kind of document (multiple pages long table) in QT correctly?

    Ps. I'm using Qt 4.7.4


    Regards,
    Jan
    Last edited by squizzz; 19th February 2012 at 17:13.

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: What is best way to print multiple pages long table?

    You can always use QPainter with a QPrinter directly. So you can draw the table yourself and check if enough space is left on the page. It is more complicated, but the only solution I can think of right now.

  3. #3
    Join Date
    Feb 2012
    Posts
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: What is best way to print multiple pages long table?

    Thanks for the answer. Yes, this is what I resulted to do in the end. Hoped that there was some way to avoid implementing document layout by hand, I quess you can't have everything, even with Qt

    Wonder if printing from webkit paginates tables correctly..

    Regards,
    Jan

Similar Threads

  1. print of all the pages of Qt Assistant
    By sujan.dasmahapatra in forum Qt Programming
    Replies: 0
    Last Post: 3rd January 2012, 07:55
  2. print several pages
    By beirrascan in forum Newbie
    Replies: 1
    Last Post: 8th November 2010, 23:26
  3. [QTableWidget] clearing a big table takes so long!
    By punkypogo in forum Qt Programming
    Replies: 4
    Last Post: 5th August 2010, 14:52
  4. Not print the range of pages
    By estanisgeyer in forum Qt Programming
    Replies: 2
    Last Post: 3rd December 2009, 18:18
  5. Cancelling Long-running Print/Print Preview
    By ChrisW67 in forum Newbie
    Replies: 4
    Last Post: 17th June 2009, 00:05

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.