Я делел так:
X++:
public void run() //метод run отчета
{
TextBuffer tb = new TextBuffer();
str path = element.printJobSettings().filename();
;
super();
tb.fromFile(path);
tb.regularExpressions(false);
tb.find('<head>');
tb.insert('\n<meta http-equiv=Content-Type content="text/html; charset=windows-1251">', tb.matchPos()+tb.matchLen());
tb.toFile(path);
}