恒月美剑
使用QPrinter生成pdf或用打印机打印数据
1.使用html生成表格
QString wesiOperateWidget::MakeDataToHtml()
{
//表头
//html = "<table width=100% border=1 cellspacing=0 text-align=center style=border-
collapse:collapse>";
//html += "<tr>";
//html += "<th>编号</th>";
//html += "<th>姓名</th>";
//html += "<th>头部成绩</th>";
//html += "<th>胸部成绩</th>";
//html += "</tr>";
////数据
//html += "<tr>";
//html += "<td align=center>1</td>";
//html += "<td align=center>赵六</td>";
//html += "<td align=center>100</td>";
//html += "<td align=center>400</td>";
//html += "</tr>";
//html += "</table>";
QString html;
html = "<table width=100% border=1 cellspacing=0 text-align=center style=border-
collapse:collapse>";
html += "<tr>";
html += "<th>编号</th>";
html += "<th>姓名</th>";
html += "<th>头部成绩</th>";
html += "<th>胸部成绩</th>";
html += "</tr>";
QStringList dataStringList;
QStringList rowInfoList;
html += "<tr>";
foreach(QString str, dataStringList)
{
rowInfoList = str.split(",");
for(int i = 0; i < 8; i += 2)
{
if(rowInfoList[i] == "number")
{
html = html + "<td align=center>" + rowInfoList[i + i] + "</td>";
}
else if(rowInfoList[i] == "name")
{
html = html + "<td align=center>" + rowInfoList[i + i] + "</td>";
}
else if(rowInfoList[i] == "headscore")
{
html = html + "<td align=center>" + rowInfoList[i + i] + "</td>";
}
else if(rowInfoList[i] == "bodyscore")
{
html = html + "<td align=center>" + rowInfoList[i + i] + "</td>";
< 2019年12月 >
日 一 二 三 四 五 六
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31 1 2 3 4
5 6 7 8 9 10 11
随笔分类 (39)
Android(1)
c#(4)
c++(13)
FFmpeg(3)
I/O模型
Java
MFC(4)
Qt(11)
Vector模板常见操作
XML专辑(1)
读写二进制文件
设计模式(1)
总结(1)
随笔档案 (39)
2015年12月(1)
2015年4月(2)
2015年3月(2)
2014年11月(2)
2014年10月(4)
2014年9月(4)
2014年8月(2)
2014年7月(2)
2013年12月(1)
2013年11月(2)
2013年3月(1)
2013年1月(1)
2012年12月(4)
2012年10月(10)
2012年3月(1)
最新评论
1. Re:Qt-字体轮廓的绘制
那个width()函数是表示什么的宽度呀
--FightingAndFunny
2. Re:libusb的简单使用
你好,初始研究usb通讯。请问输入输出端口
怎么获取呢?可以通过程序自动获取吗?还是
需要usb设备说明提供?
博客园 首页 新随笔 订阅 管理
评论0
最新资源