patrik08
19th July 2007, 22:29
I spend two day to dispay and edit the XSL-Fo format is similar from dock book KDE..
now i can not grab QTextDocument to resave to xml file. :mad:
Question:
Why QTextFrame can not find image or table? inside a QTextFrame::iterator from QTextDocument
Or is image part from fragment? how grab this?
i have one image and one table inside and iterator not find? why .. pleas help .
I not found any sample to iterate QTextDocument http://doc.trolltech.com/4.2/richtext-structure.html
//////QTextDocument *w3 = fop.GetDoc() [ return QTextDocument->clone() ] XSL-FO format ;
/////QTextFrame *Tframe = w3->rootFrame();
int speed = 0;
qDebug() << "### iterator start ############################" << speed;
/* QTextFrameFormat QTextFrame::frameFormat() const */
QTextFrame::iterator it;
for (it = Tframe->begin(); !(it.atEnd()); ++it) {
speed++; /* to find tree structure */
QTextFrame *childFrame = it.currentFrame();
QTextBlock para = it.currentBlock();
if (childFrame) {
qDebug() << "### frame " << speed;
} else if (para.isValid()) {
qDebug() << "### block " << speed << " Paragraph ->" << para.text();
if (para.charFormat().isValid()) { /* QTextCharFormat */
QTextCharFormat subpara = para.charFormat();
qDebug() << "### inline span " << speed;
if ( subpara.toImageFormat().isValid() ) {
QTextImageFormat Pic = subpara.toImageFormat();
qDebug() << "### image " << speed;
} else if ( subpara.toTableFormat().isValid() ) {
QTextTableFormat Ta = subpara.toTableFormat();
qDebug() << "### table " << speed;
}
}
}
}
qDebug() << "### iterator end ############################" << speed;
now i can not grab QTextDocument to resave to xml file. :mad:
Question:
Why QTextFrame can not find image or table? inside a QTextFrame::iterator from QTextDocument
Or is image part from fragment? how grab this?
i have one image and one table inside and iterator not find? why .. pleas help .
I not found any sample to iterate QTextDocument http://doc.trolltech.com/4.2/richtext-structure.html
//////QTextDocument *w3 = fop.GetDoc() [ return QTextDocument->clone() ] XSL-FO format ;
/////QTextFrame *Tframe = w3->rootFrame();
int speed = 0;
qDebug() << "### iterator start ############################" << speed;
/* QTextFrameFormat QTextFrame::frameFormat() const */
QTextFrame::iterator it;
for (it = Tframe->begin(); !(it.atEnd()); ++it) {
speed++; /* to find tree structure */
QTextFrame *childFrame = it.currentFrame();
QTextBlock para = it.currentBlock();
if (childFrame) {
qDebug() << "### frame " << speed;
} else if (para.isValid()) {
qDebug() << "### block " << speed << " Paragraph ->" << para.text();
if (para.charFormat().isValid()) { /* QTextCharFormat */
QTextCharFormat subpara = para.charFormat();
qDebug() << "### inline span " << speed;
if ( subpara.toImageFormat().isValid() ) {
QTextImageFormat Pic = subpara.toImageFormat();
qDebug() << "### image " << speed;
} else if ( subpara.toTableFormat().isValid() ) {
QTextTableFormat Ta = subpara.toTableFormat();
qDebug() << "### table " << speed;
}
}
}
}
qDebug() << "### iterator end ############################" << speed;