Hello!
I would like to ask you, if you know how to horizontal align a text in a cell of a QTextTable?
Thank you,
Willi
Hello!
I would like to ask you, if you know how to horizontal align a text in a cell of a QTextTable?
Thank you,
Willi
Did you notice QTextTable::setFormat() and QTextTableFormat::setAlignment()?
J-P Nurmi
Yes, but this works only for the whole table.
I would like to have a table where the text of the first column is aligned to the left, and the second column is aligned right...
Did you already find a solution? I'm trying this as well with no succes until now...
http://doc.trolltech.com/main-snapsh...Alignment-enum
on new QTextTableCellFormat Qt 4.4. you can set padding -
setTopPadding ( qreal padding )
setRightPadding ( qreal padding )
setBottomPadding ( qreal padding )
setLeftPadding ( qreal padding )
and you can format textblock inside cell
Qt Code:
To copy to clipboard, switch view to plain text mode
http://doc.trolltech.com/main-snapsh...harformat.html
http://doc.trolltech.com/main-snapsh...ellformat.html
http://doc.trolltech.com/main-snapsh...tablecell.html
A fast way to generate document on qt after 4.5 is xslt!
xml data + style .. or db to xml + style xslt
Qt Code:
#if QT_VERSION >= 0x040500 StreamBuf *buf = new StreamBuf(); QXmlQuery xquery(QXmlQuery::XSLT20); xquery.setQuery(QUrl("http://fop-miniscribus.googlecode.com/svn/trunk/doc/draw_paper/browser_rss.xsl")); xquery.evaluateTo(buf->device()); _doc->setHtml ( buf->data() ); ////////////buf->PutOnFile( "ddebughtml.html" ); #endifTo copy to clipboard, switch view to plain text mode
try to build -> http://fop-miniscribus.googlecode.co...oc/draw_paper/
Last edited by patrik08; 13th October 2008 at 19:36.
Thanks for your reply.
for me
Qt Code:
QTextBlockFormat rightAlignment; rightAlignment.setAlignment(Qt::AlignRight); testTable->cellAt(0,0).firstCursorPosition().setBlockFormat(rightAlignment); testTable->cellAt(0,0).lastCursorPosition().insertText("test"); // etc.To copy to clipboard, switch view to plain text mode
did the trick. Previously I was unsuccesfully trying to do an insertBlock() at the cursorposition, resultiing in two textblocks per cell.
Bookmarks