Issue 125190 - OpenOffice writer stops responding on open or insert html file
Summary: OpenOffice writer stops responding on open or insert html file
Status: CLOSED DUPLICATE of issue 121320
Alias: None
Product: Writer
Classification: Application
Component: open-import (show other issues)
Version: 4.1.0
Hardware: All All
: P3 Normal (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
Depends on:
Reported: 2014-07-02 14:46 UTC by schlocke
Modified: 2017-05-20 10:11 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---

test.html (96.23 KB, text/html)
2014-07-02 14:47 UTC, schlocke
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description schlocke 2014-07-02 14:46:31 UTC
Try opening attached file.
I think the problem is the embedded image. But this is html standard, it have to work.
Comment 1 schlocke 2014-07-02 14:47:41 UTC
Created attachment 83630 [details]

File that causes OpenOffice to stop responding
Comment 2 Ariel Constenla-Haile 2014-07-02 15:13:03 UTC
(In reply to schlocke from comment #0)
> I think the problem is the embedded image.

Yes. OpenOffice does not know how to handle them.

*** This issue has been marked as a duplicate of issue 121320 ***
Comment 3 schlocke 2014-07-02 15:23:50 UTC
This workaround just writes the embedded jpg content to an external file (java code):

          Pattern p = Pattern.compile("src=\"data\\:image/jpeg;base64,([A-Za-z0-9\\+/]+)\"");
          Matcher m = p.matcher(htmlContent);
          StringBuffer n = new StringBuffer(htmlContent.length());
          int i = 0;
          while (m.find())
            String s =;
            byte[] bytes = Base64.decode(s);
            File picTmpFile = Komet3Tools.getTempFile("jpg");
            FileUtils.writeByteArrayToFile(picTmpFile, bytes);
            n.append(htmlContent.substring(i, m.start()));
            i = m.end();
          htmlContent = n.toString();

- htmlContent is the html file as a String
- Komet3Tools.getTools.getTempFile("jpg") return a temporäry file with extension .jpg
- Base64 is a simple base64-decoder