in reply to bold color text and export to file
in thread bold color text and export to file

roboticus's suggestion can easily be adapted to output HTML (why did you stop using it when it "worked like charm"?). Simply replace the part that calls the colored function with your "<font ..." strings. Keep in mind roboticus's comment that the positions for replacements need to be in descending order, so you may want to sort your array of positions accordingly.