title: Opening *.odt files using Qt
body: <p>I'm writing a program and I have to write a code which opens *.odt files. My idea is to extract content.xml file from *.odt document, and set the text from this xml file to my QTextEdit object. I made first part of this operation. Now I've got a problem with setting xml text to QTextEdit. For example, I've got a QDomDocument object which contains this xml file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" office:version="1.2"&gt;
    &lt;office:automatic-styles&gt;
      &lt;style:style style:name="c0" style:family="text"&gt;
        &lt;style:text-properties fo:font-family="Sans"/&gt;
      &lt;/style:style&gt;
      &lt;style:style style:name="p1" style:family="paragraph"&gt;
        &lt;style:paragraph-properties/&gt;
      &lt;/style:style&gt;
      &lt;style:style style:name="c10" style:family="text"&gt;
        &lt;style:text-properties fo:font-family="Sans" fo:font-size="14pt" style:text-underline-style="none" fo:color="#ff0004"/&gt;
      &lt;/style:style&gt;
      &lt;style:style style:name="c8" style:family="text"&gt;
        &lt;style:text-properties fo:font-family="Sans" fo:font-size="14pt" style:text-underline-style="solid"/&gt;
      &lt;/style:style&gt;
      &lt;style:style style:name="c6" style:family="text"&gt;
        &lt;style:text-properties fo:font-style="italic" fo:font-family="Sans" fo:font-size="14pt"/&gt;
      &lt;/style:style&gt;
      &lt;style:style style:name="c4" style:family="text"&gt;
        &lt;style:text-properties fo:font-weight="bold" fo:font-family="Sans" fo:font-size="14pt"/&gt;
      &lt;/style:style&gt;
    &lt;/office:automatic-styles&gt;
    &lt;office:body&gt;
      &lt;office:text&gt;
        &lt;text:p text:style-name="p1"&gt;&lt;text:span text:style-name="c4"&gt;BOLD&lt;/text:span&gt;&lt;/text:p&gt;
        &lt;text:p text:style-name="p1"&gt;&lt;text:span text:style-name="c6"&gt;ITALIC&lt;/text:span&gt;&lt;/text:p&gt;
        &lt;text:p text:style-name="p1"&gt;&lt;text:span text:style-name="c8"&gt;UNDERLINED&lt;/text:span&gt;&lt;/text:p&gt;
        &lt;text:p text:style-name="p1"&gt;&lt;text:span text:style-name="c10"&gt;RED TEXT&lt;/text:span&gt;&lt;/text:p&gt;
      &lt;/office:text&gt;
    &lt;/office:body&gt;
  &lt;/office:document-content&gt;
  </code></pre>
  
  <p>Now I want to set this QDomDocument text to QTextEdit. I tried to do this using this line:</p>
  
  <pre><code>editor-&gt;setHtml(doc.toString()); // editor is a QTextEdit object and doc is QDomDocument
  </code></pre>
  
  <p>Here's my problem. After this line I've got a plain text in my editor (without any formatting, color etc.). How can I solve this? </p>