diff --git a/product/ERP5OOo/transforms/html_to_odt.py b/product/ERP5OOo/transforms/html_to_odt.py index 1c2881a8e7ac1d21759eb05d4ad64005dcf9a7f0..582e677a7a13d8fc0c994d89c5d49c2b74bf7ad3 100644 --- a/product/ERP5OOo/transforms/html_to_odt.py +++ b/product/ERP5OOo/transforms/html_to_odt.py @@ -44,6 +44,10 @@ class HTMLToOdt: 'content': 'text/html; charset=utf-8'}) orig = html.tostring(html_node, encoding='utf-8', method='xml') + # workaround a Bug in LibreOffice HTML import filter. + # https://bugs.freedesktop.org/show_bug.cgi?id=36080 + orig = orig.replace('<title/>', '<title></title>') + import pdb;pdb.set_trace() doc = OOOdCommandTransform(context, filename, orig, self.inputs[0]) odt = doc.convertTo('odt') if cache is not None: diff --git a/product/ERP5OOo/transforms/oood_commandtransform.py b/product/ERP5OOo/transforms/oood_commandtransform.py index 821272b11975333606c24164b9edb2ea1415b10f..e70d3d4b0f3586dc96ee5d34030ac20e24049a98 100644 --- a/product/ERP5OOo/transforms/oood_commandtransform.py +++ b/product/ERP5OOo/transforms/oood_commandtransform.py @@ -12,6 +12,7 @@ from zLOG import LOG from Products.ERP5OOo.OOoUtils import OOoBuilder import re from lxml import etree +from lxml import html from lxml.etree import ParseError, Element from urllib import unquote @@ -193,8 +194,9 @@ class OOOdCommandTransform(commandtransform): parent_node.append(style_node) style_node.attrib.update({'type': 'text/css'}) parent_node.remove(css_link_tag) - return etree.tostring(xml_doc, encoding='utf-8', - xml_declaration=False, pretty_print=False, ) + xml_output = html.tostring(xml_doc, encoding='utf-8', method='xml') + xml_output = xml_output.replace('<title/>', '<title></title>') + return xml_output def convertTo(self, format): server_proxy = OOoServerProxy(self.context)