首先,非常感谢 LZ 的 分享大作。 刚好在弄打印这块,而且还真的是要用lodop来做这个。 所以受益匪浅。然后,这里有个问题,想跟LZ请教下, 在使用以下我的sample.mako模板代码时,发现maktohtml2html.py文件中的 方法 format_body中,有一个问题。body[:-1]得到是一个空的list, 因为 body = html.findall("body"), 对于一个Html文件来说, <body>标签只有1个。 所以这个我觉得是个问题,不知道LZ是什么解决的? 我一个小打算,是直接提bug,修改openerp的源码来搞定这件事情。 不知道还有其他的方法没有?openerp 的源码部分: def format_body(self, html): body = html.findall('body') body_list = [] footer = self.format_footer(body[-1].getchildren()) for b in body[:-1]: body_list.append(etree.tostring(b).replace('\t', '').replace('\n',''))mako文件的代码。(文件名不是html,在openerp报告中没有问题。)<html><head> <title>test mako template</title></head><body> <table> order_number: 12345 </table><footer></footer></body></html>