Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTextDocument and HTML atributes
Forum Updated to NodeBB v4.3 + New Features

QTextDocument and HTML atributes

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AttilaPethe
    wrote on last edited by
    #1

    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!

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved