vin*_*vin 5 html c++ visual-studio-2010
好吧,我已完成编码并且我的所有结果都已准备就绪,我现在需要做的就是创建HTML报告以显示这些结果.如何使用C++创建HTML报告?任何的想法?如果它有帮助,我使用Visual Studio来编译和运行我的代码,虽然我不是非常热衷于使用VS库,我更喜欢使用C++ std库,如果有的话.先感谢您
一种快速的方法是将 html 标签写为字符串。这是一个例子
ofstream myfile;
myfile.open ("C:\\report.html");
myfile << "<!DOCTYPE html><html><head></head><body>"; //starting html
//add some html content
//as an example: if you have array of objects featuring the properties name & value, you can print out a new line for each property pairs like this:
for (int i=0; i< reportData.length(); i++)
myfile << "<p><span style='font-weight: bold'>" << reportData[i].name << "</span><span>" << reportData[i].value << "</span></p>";
//ending html
myfile << "</body></html>";
myfile.close();
Run Code Online (Sandbox Code Playgroud)
编辑:更新代码
| 归档时间: |
|
| 查看次数: |
16547 次 |
| 最近记录: |