none
ziping parts error RRS feed

  • Question

  • Hi,

    I created a presentationml from scratch using xmldocument. ( I am emulating it from Matlab, that is why it is somehow simpler than openxml SDK).

    I used "ZipFile.CreateFromDirectory" to package all the files and folder. I can start the document by double clicking on it and it works.

    But trying  PresentationDocument.Open('newdoc.pptx'). I get the error "missing part". I therefore cannot us "validate".

    What is weird to me, is that if I do not use "CreatFromDirectory" and that I pass the all the document manually to a manually precreated zipfile, then change the "zip" to "pptx"  the PresentationDocument.Open works!

    Anyone wo could help me who knows what should be used to zip all the files together that would mimic the manual process?

    Thank you,

    Wednesday, September 9, 2015 8:10 PM

Answers

  • Hi boumbounm,

    This issue is cauesd that the method you package the file is different with Open XML SDK. We can generate a presentation using Open XML SDK then copy the file and change it to ZIP. Then we can extract the files from the package and package it using "CreatFromDirectory" and compare the package getted with the one generate from Open XML SDK.

    I suggest that you always use Open XML SDK to manipulate the Office documents since it is more robust then modify the XML directly.

    Also you may be intrested how the Open XML SDK works, since the Open XML SDK is open source, you get the the source code from link below:
    OfficeDev/Open-XML-SDK · GitHub

    Hope it is helpful.

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by boumboum Friday, September 11, 2015 6:47 PM
    Thursday, September 10, 2015 5:59 AM
    Moderator

All replies

  • Hi boumbounm,

    This issue is cauesd that the method you package the file is different with Open XML SDK. We can generate a presentation using Open XML SDK then copy the file and change it to ZIP. Then we can extract the files from the package and package it using "CreatFromDirectory" and compare the package getted with the one generate from Open XML SDK.

    I suggest that you always use Open XML SDK to manipulate the Office documents since it is more robust then modify the XML directly.

    Also you may be intrested how the Open XML SDK works, since the Open XML SDK is open source, you get the the source code from link below:
    OfficeDev/Open-XML-SDK · GitHub

    Hope it is helpful.

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by boumboum Friday, September 11, 2015 6:47 PM
    Thursday, September 10, 2015 5:59 AM
    Moderator
  • Hi Fei,

    Thank you very much for your answer. I finally fixed the issue today ( as I was off yesterday). It is clearly  "CreatFromDirectory" that does not work, but I do not know why, I tried with a standard presentation. Maybe a security issue, because the files are similar. I ended up using CreateEntry and StreamWriter and everything works fine now.

    If I do not use Openxml SDK, as I clearly should, it is because I use Matlab, and .net is not very well managed (abstract classes are a catastrophe), therefore it is actually faster to just create some functions that will manage the DocumentXml. And I think that trying to copy unzipped presentation model is actually faster by just creating required nodes.

    Thank you for your support and have a nide day!


    Friday, September 11, 2015 6:47 PM