Why image/jpeg file extension is changed to .bin after slide copy?

Home Forums PresentationML Why image/jpeg file extension is changed to .bin after slide copy?

This topic contains 3 replies, has 2 voices, and was last updated by  Eric White 8 years, 9 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2518

    sliu
    Participant

    Hi Eric,

    The theme in Contoso.pptx has the embedded image/jpeg. The following is the part of xml from /ppt/theme/theme1.xml.

    <a:blip xmlns:r=”http://schemas.openxmlformats.org/officeDocument/2006/relationships” r:embed=”rId1″>
    <a:duotone>
    <a:schemeClr val=”phClr”>
    <a:tint val=”30000″/>
    <a:satMod val=”300000″/>
    </a:schemeClr>
    <a:schemeClr val=”phClr”>
    <a:tint val=”40000″/>
    <a:satMod val=”200000″/>
    </a:schemeClr>
    </a:duotone>
    </a:blip>

    I see in CopyRelatedImage method, it calls

    newPart = ((ThemePart)newContentPart).AddImagePart(oldPart.ContentType);

    However, newPart.Uri = “/ppt/slideMasters/media/image.bin” and its image extension is changed from .jpeg to .bin. Do you know why?

    How can I create media files under /ppt/media instead of under /ppt/slideMasters/media?

    The same thing happens when copying video and audio files. Those files don’t have any file extensions. That is why they are not playable in the generated pptx. Can you let me know how to fix it?

    Thanks in advance!!!

    #2520

    sliu
    Participant

    Hi Eric,

    In PresentationBuilder::CopyRelatedImage, it calls

    var oldPartIdPair = oldContentPart.Parts.FirstOrDefault(p => p.RelationshipId == relId);

    I looked into oldPartIdPair, in its OpenXmlPart.Non-Public memebers, TargetFileExtension = “.bin”.

    I think this is assigned by OpenXml SDK. Does this mean the bug is in OpenXml SDK instead of in PresentationBuilder. Do you know how long it will take to fix it? I really need to make video working using OpenXml SDK.

    Thanks

    #2522

    Eric White
    Keymaster

    Are you sure that this is the reason that files are not playable in the PPTX? In general, Open XML does not care what the exact file name is. It only cares what the relationship type is, and what the content type for the part is.

    The behavior you see where the file is renamed with extension of .bin, this is functionality in the Open-Xml-Sdk, not Open-Xml-PowerTools.

    We need to ascertain with certainty whether the name of the file has significance in PowerPoint. It should not, but who knows what they did inside PowerPoint.

    #2524

    Eric White
    Keymaster

    If you determine with certainty that the name of the file causes PowerPoint to not play the video, then you can use System.IO.Compression to open the ZIP and fix the file name.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.