Important: Please read the Qt Code of Conduct -

[SOLVED]QTextDocument, table and table border width 1px.

  • Hello.

    I'm create table by two ways:
    @QTextTableFormat tableFormat;
    tableFormat.setWidth(QTextLength(QTextLength::PercentageLength, 40));
    m_cursor->insertTable(4, 2, tableFormat);@
    and with HTML
    @QString tableStr;
    tableStr.append("<table align="center" border="1">");

    And the table have a "3D" border. How I can set thin border.

    Many thanks.

  • For the first one:
    And for the second one:
    @tableStr.append("<table align="center" "style"="border: solid 1px;">")@
    remove the " around style, it wouldn't show up in the post without it.
    Hope that helps.

  • thanks for reply.

    @tableFormat.setBorderMargin(1);@ - there is no setBorderMardin method in the QTextTableFormat :( There is setMargin(qreal) method, but it has no effect :(
    I found tableFormat.setCellSpacing(0), which make border more thin.

    "And for the second one: "
    I set "<table "style"="border:solid 1px;">" but, I can't see any border :(.

    Can anybody talk me, how to make table with QTextCursor::insertTable if table is a difficult (have a cells with a "rowspan" and "colspan")?

    I found @QTextTable::mergeCells(int row, int col, int rowspan, int colspan);@

Log in to reply