none
PowerPoint Addin - Resources File Path RRS feed

  • Question

  • Hello, I've created a powerpoint addin, which is adding some shapes (pictures) to the slides.

    Thing is, the AddPicture method needs a filename, so for now it was working with an absolute path. How can I reference a project resource instead?

    I thought about using embedded resource, but there's no overload method using stream. I also tried some other approaches, such as "~/Folder/picture_x.png" but with no success thus far.

    Is there a way to "store" resources inside an add-in?

    Thanks
    Thursday, June 5, 2014 7:49 PM

Answers

  • Hello,

    You are right, the AddPicture method requires a file path. The fact is that Office applications supports COM add-ins and don't know anything about .Net based add-ins. If you want to use resources in managed assemblies you need to save the file on a disk first (a temporarily folder can be used for this). Only then you can call the AddPicture method.

    You may find the How can i extract a file from an embedded resource and save it to Disk? forum thread helpful.

    • Marked as answer by Apidcloud Friday, June 6, 2014 5:34 PM
    Friday, June 6, 2014 1:43 PM

All replies

  • Hello,

    You are right, the AddPicture method requires a file path. The fact is that Office applications supports COM add-ins and don't know anything about .Net based add-ins. If you want to use resources in managed assemblies you need to save the file on a disk first (a temporarily folder can be used for this). Only then you can call the AddPicture method.

    You may find the How can i extract a file from an embedded resource and save it to Disk? forum thread helpful.

    • Marked as answer by Apidcloud Friday, June 6, 2014 5:34 PM
    Friday, June 6, 2014 1:43 PM
  • Hi,

    I was actually thinking about doing that, but at least now I'm aware that it's the only way and the reason behind it.

    Thanks

    Friday, June 6, 2014 5:37 PM