PDA

View Full Version : QPrinter for QTextEdit



sms
17th July 2008, 16:21
Hello :)

I use QPrinter to print a table which I create using HTML QTextEdit.

I will appreciate if somebody can give me a hint of why when printing the table I only get the first page with the first columns and stops. I dont get the rest of the pages with the rest of the table. What should I set so I can get all? :(

* Part of my code:


QTextEdit text(table) // I checked "table" and it is complete.
// If I send it to the clipboard and paste it in excel it looks fine.

QPrinter printer(QPrinter::HighResolution);
printer.setFullPage(true);
QPrintDialog printDialog(&printer);
printDialog.setEnabledOptions(QAbstractPrintDialog ::PrintPageRange);
printDialog.setPrintRange(QAbstractPrintDialog::Al lPages);
if (text.textCursor().hasSelection()){
printDialog.addEnabledOption(QAbstractPrintDialog: :PrintSelection);
}
printDialog.setWindowTitle(tr("Printer"));

if (printDialog.exec() == QDialog::Accepted) {
text.print(&printer);
}


Thanks in advance