Print HP Quality Center Report

September 27th 2013 by Samuel Rossille

In every developper there is a hooligan that waits for the right time to be unsleashed and write horrible trash code. All he needs is a good reason to get out and get the job done the dirty way - although some are not that picky about what a good reason is ;=)

So today I created a new category on my website: "Shameless Hacking". The only rule will be: have a good reason to do it. Or at least pretend. The first article is on how to use jQuery to fix the ugly HTML export of HP Quality center just enough to make a print copy usable.

Now, let's get down to (dirty) business.

Today I had to evaluate the workload of fixing a very large number of issues that were reported in a bug tracking system called HP Quality Center. I had to read through the detail of each single issue to evaluate the workload precisely, because the large diversity of the sample made any statistical approach to this exercise too risky. So I wanted to print an export of the bug reports and work on it calmly in an empty quiet room with my paper and my pen.

Problem: none of the existing export formats (or at least the ones that didn't cause a crash) allows to print in a way that is suitable to the task. So I loaded the full HTML export and did a bit of jQuery hacking to manipulate the structure of the document and make it printable in a decent format.

// Add jQuery to the context
var script = document.createElement("SCRIPT");
script.src = ""

// Remove the change history (very redundant and not very usefull) 
var hh1 = $($("td h1").filter(function(){return $(this).text() == 'History:';}))

// Get list of tr that contain bugs
var bugs = $("h3").parent().parent().parent().parent().parent().parent().parent()

// Reorganize the document to remove the rubbish and add page breaks
$.each(bugs, function() {
        $('<table style="page-break-after: always;"></table>')

Have a good hacking night ;=)


Hello there: Next time I read a blog, Hopefully it won't disappoint me just as much as this one. After all, I know it was my choice to read, nonetheless I genuinely believed you'd have something helpful to say. All I hear is a bunch of crying about something that you could fix if you weren't too busy searching for attention. Awesome ;=) thanks for the constructive feedback... by the way this article is about how I could fix the issue. I described it, because it was quite a funny thing to do. Oh, and your link is broken.