QTextDocument HTML table problem
-
I'm trying to print a table using QPrinter and QTextDocument. I want a table with single-line borders, but I get weird result:
!http://rain.ifmo.ru/~imihajlov/table.png(Table)!
The HTML code is:
@<table width="100%" cellspacing="0" cellpadding="2px">
<tr>
<th width="20%">Test</th>
<th width="20%">Nominal</th>
<th width="10%">Col. 1</th>
<th width="10%">Col. 2</th>
<th width="10%">Col. 3</th>
<th width="10%">Col. 4</th>
<th width="10%">Col. 5</th>
<th width="10%">Col. 6</th>
</tr>
........
</table>@What should I do to make borders single-lined? border-collapse does not work.
-
Under Linux/Windows you get a print preview, try to see there the html table lines. If there is ok, problem is probably with your printer.
-
It's a screenshot from PDF. Real printing produces the same output. Even more, I have tested the same HTML code with QtCreator's form editor, it produces the same lines.
-
As you can see "here":http://qt-project.org/doc/qt-4.8/richtext-html-subset.html border-collapse is not supported.
I faced the same problem last week. But I couldn't figure out a solution.
-
Now I'm using xhtml2pdf instead :)
-
I searched once more the depths of the WEB and found a solution, that might interest you.
@ QWebView web;
web.setHtml(strHtml);
QPrinter printer;
web.print(&printer);
@It works fine.
-
It should, but QWebView is not acceptable for my task as a part of WebKit.