QTextDocument and HTML atributes



  • I load a document in QTextDocument from a html file but all the HTML table attributes are lost. (TD ROWSPAN=... WIDTH=...% VALIGN=....). Do someone know a workaround for this?

    @void MainWindow::preparedocument(void)
    { QTextDocument document;
    document.setUseDesignMetrics(true);
    QString filename = "htmlfile.html";
    QFile file(filename);
    QByteArray data = file.readAll();
    QTextCodec *codec = Qt::codecForHtml(data);
    QString str = codec->toUnicode(data);
    document.setHtml(str);
    document.setDocumentMargin(2);@

    In the html file I have attributes for a table like:

    @<TR>
    <TD WIDTH=25% VALIGN=TOP>
    <P >Text to show</P>
    <P>Text to show</P>
    </TD>
    <TD WIDTH=25%>
    <P ALIGN=CENTER >Text to show</P>
    </TD>
    <TD ROWSPAN=9 WIDTH=3% VALIGN=TOP>
    <P><BR>
    </P>
    </TD>
    <TD WIDTH=23% VALIGN=TOP>
    <P >Text to show</P>
    <P>Text to show</P>
    </TD>
    <TD WIDTH=24%>
    <P ALIGN=CENTER>Text to show</P>
    </TD>
    </TR>
    @

    The <B> and </B> attributes are OK. What to do with the rest? Thanks for the answers in advance!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.