Results 1 to 6 of 6

Thread: Qt 4.7 export html document to pdf: strange

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2008
    Posts
    276
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Post Qt 4.7 export html document to pdf: strange

    I just moved to Qt 4.7. Compilation is a charm but when I use the export to pdf document of an html content, results are different with respect to previous version.
    The code (that I did not change)
    Qt Code:
    1. medie = " <table width=680><tbody><tr bgcolor=\"lightGray\" ><td colspan=3 >"+ QObject::tr("Valori medi mensili") +"</td></tr>";
    2. medie +="<tr><td colspan=3>";
    3. medie +="<table width=100% border=1 cellspacing=0 cellpadding=3 ><tr><td></td>";
    4. medie += "<td>" + QObject::tr("Energia[")+unitEnergy+"]" + "</td>";
    5. medie += "<td>" + QObject::tr("Fattore Ombre[%]") + "</td>";
    6. medie += "<td>" + QObject::tr("Perdite termiche[%]") + "</td>";
    7. medie += "<td>" + QObject::tr("Altre perdite[%]") + "</td>";
    8. medie += "<td>" + QObject::tr("Temp. medie[<sup>o</sup>]") + "</td>";
    9. medie += "<td>" + QObject::tr("Vento medio[m/s]") + "</td>";
    10. medie += "</tr>";
    11.  
    12. for(int i=0;i<12;i++) {
    13. medie += "<tr>";
    14. medie += "<td>" + MyMath::months(i+1) + "</td>";
    15.  
    16. if (Eset)
    17. medie += "<td>" + QString("%L1").arg(E[i],0,'f',2) + "</td>";
    18. else
    19. medie += "<td>" + QString("%L1").arg(0) + "</td>";
    20.  
    21.  
    22. medie += "<td>" + QString("%L1").arg((opt.shadows.at(i))*100,0,'f',2) + "</td>";
    23.  
    24.  
    25. medie += "<td>" +QString("%L1").arg((1-
    26. opt.thermalLosses.at(i))*100,0,'f',2) +"</td>";
    27.  
    28. medie += "<td>" + QString("%L1").arg((opt.otherLoss.at(i))*100,0,'f',2) +"</td>";
    29.  
    30.  
    31. medie += "<td>" + QString("%L1").arg(opt.temperatures.at(i),0,'f',2) +"</td>";
    32.  
    33. medie += "<td>" +QString("%L1").arg(opt.wind.at(i),0,'f',2) + "</td>";
    34.  
    35. medie += "</tr>";
    36. }
    37. medie += "</table>";
    38.  
    39. medie += "</td></tr></tbody></table>";
    To copy to clipboard, switch view to plain text mode 
    And I print on a qprinter by using
    Qt Code:
    1. m_cursor.insertHtml(medie);
    2. m_document->drawContents(&p,printer->paperRect());
    To copy to clipboard, switch view to plain text mode 
    But the result is a broken table
    as attached in the picture.
    Why?
    Attached Images Attached Images

  2. #2
    Join Date
    May 2008
    Posts
    276
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt 4.7 export html document to pdf: strange

    Nobody interested in this bug?
    Can someone reproduce the same result?
    Regards

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Qt 4.7 export html document to pdf: strange

    What is the actual HTML that is generated? The snippet you provide above shows generation of part of a table inside (I assume) an outer table cell.

  4. #4
    Join Date
    May 2008
    Posts
    276
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt 4.7 export html document to pdf: strange

    No. If you look carefully there are two tables, one inside the other.
    If I put the output to a file and then open it with a web browser, the result is correct.
    In previous version of Qt I never had such misprinting problem.

  5. #5
    Join Date
    May 2008
    Posts
    276
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt 4.7 export html document to pdf: strange

    Nobody intrested? I also have the same problem in other similar tables...simple Chrome-readable tables.

  6. #6
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Qt 4.7 export html document to pdf: strange

    I cannot reproduce the result with either 4.6.3 or 4.7.0 on Linux. I substituted 0 for the actual figures and the month number in place of the month name, but otherwise used your code. I also used the print() method of QTextDocument with good results.

Similar Threads

  1. Replies: 0
    Last Post: 2nd August 2010, 09:37
  2. how to export dll with gui?
    By cutie.monkey in forum Qt Programming
    Replies: 5
    Last Post: 14th November 2009, 02:19
  3. Help document
    By weixj2003ld in forum Qt Programming
    Replies: 5
    Last Post: 17th May 2009, 12:04
  4. Export SVG: Qwt Bug?
    By giusepped in forum Qwt
    Replies: 4
    Last Post: 19th December 2008, 10:50
  5. HTML document
    By jamd in forum Qt Programming
    Replies: 1
    Last Post: 28th June 2006, 20:49

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
  •  
Qt is a trademark of The Qt Company.