Bug 70616

Summary: FILESAVE: docx: JPG images not saved on export
Product: LibreOffice Reporter: Jacobo Aragunde Pérez <jaragunde>
Component: WriterAssignee: Jacobo Aragunde Pérez <jaragunde>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: medium CC: barta
Version: 4.2.0.0.alpha0+ Master   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Test case

Description Jacobo Aragunde Pérez 2013-10-18 12:26:01 UTC
Created attachment 87822 [details]
Test case

The attached file contains a JPG image embedded into a document as a Draw object. When you export this document to docx the image itself is not saved: if you unzip the docx file you will see that /word/media/ contains a 0-byte file called "image1".


Why is this happening? Look at the code that should save the image file:

oox/source/export/vmlexport.cxx:559

if ( rProps.GetOpt( ESCHER_Prop_fillBlip, aStruct ) && m_pTextExport)
{
    SvMemoryStream aStream;
    int nHeaderSize = 25; // The first bytes are WW8-specific, we're only interested in the PNG
    aStream.Write(aStruct.pBuf + nHeaderSize, aStruct.nPropSize - nHeaderSize);
    aStream.Seek(0);
    Graphic aGraphic;
    GraphicConverter::Import(aStream, aGraphic, CVT_PNG);
    OUString aImageId = m_pTextExport->GetDrawingML().WriteImage( aGraphic );
    pAttrList->add(FSNS(XML_r, XML_id), OUStringToOString(aImageId, RTL_TEXTENCODING_UTF8));
}

As you can see, CVT_PNG is hard-wired here.

If you had used a PNG image it would have been properly saved but the image wouldn't appear when you open back that saved .docx that's a different bug anyway ;) (probably #65836).
Comment 1 Jacobo Aragunde Pérez 2013-10-29 16:40:31 UTC
This change addresses this issue among others: https://gerrit.libreoffice.org/6369
Comment 2 tommy27 2013-12-31 12:03:03 UTC
I think this issue is a duplicate of Bug 52226.
I Hope you comments about saving code could help the devs.

*** This bug has been marked as a duplicate of bug 52226 ***

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.