Reputation: 11
I need help with this. I have a PDF I am generating with QTextDocument
, and I am using HTML to format it. I am making an invoice for a quote. However, I want the description of the part to remain in the place I put it, while the price be right justified, it doesn't work in QT while its working in a normal HTML file. My code is as follows:
QTextDocument document;
QString test = "<!DOCTYPE html><html><head><title>help</title><style type='text/css'>.left{float: left;}.right{float: right;}</style></head><body><div class='left'>Span Left</div><div class='right'>Span Right</div></body></html>";
// document.setDefaultStyleSheet();
document.setHtml(test);
This will not let the text align and just uses div and puts one text above and below the other. Any suggestions?
Upvotes: 1
Views: 1185
Reputation: 4484
QString test = " \
<!DOCTYPE html> \
<html> \
<head> \
<title>help</title> \
</head> \
<body> \
<div align='left'>Span Left</div> \
<div align='right'>Span Right</div> \
</body> \
</html>";
Try this and refer Supported HTML Subset
Upvotes: 1