Well, I have finished coding and all my results are ready, all I need to do now is create HTML reports to display these results. How do I create HTML report using C++? any Idea? If it helps, I am using Visual Studio to compile and run my code, although I am not very keen on using VS libraries and I would prefer using C++ std libraries, if there are any. Thank you in advance
A quick way to do it is simply writing the html tags as strings. Here's an example
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();
Edit: updated code
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With